Skip to content

fix: wait for callkit audio activation and then start audio engine, remove the previous timeout - #2328

Merged
santhoshvai merged 6 commits into
mainfrom
fix/callkit-audio-activation
Jul 29, 2026
Merged

fix: wait for callkit audio activation and then start audio engine, remove the previous timeout #2328
santhoshvai merged 6 commits into
mainfrom
fix/callkit-audio-activation

Conversation

@santhoshvai

@santhoshvai santhoshvai commented Jul 9, 2026

Copy link
Copy Markdown
Member

💡 Overview

depends on GetStream/react-native-webrtc#53

Also:

  • adds tracer for iOS audio packets not flowing problem
  • reapply audio config on didActivate as per apple advice

Summary by CodeRabbit

  • Bug Fixes
    • Improved iOS CallKit audio lifecycle by more strictly gating the WebRTC engine during early start/answer, and correctly toggling engine availability on activation/deactivation.
    • Improved non-CallKit engine startup by explicitly restoring default engine availability.
    • Removed iOS audio-session activation promise coordination to avoid startup waits.
  • Diagnostics
    • Enhanced iOS tracing for CallKit audio-session activation/deactivation and added “silent-mic” detection via audio device recording-state sampling.
  • Chores
    • Bumped the WebRTC dependency to 145.1.1 across packages and sample apps, and expanded the npm preapproved allowlist.

@santhoshvai
santhoshvai marked this pull request as draft July 9, 2026 14:11
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7b79413d-d4e9-4e8e-99b7-8cea00099dc3

📥 Commits

Reviewing files that changed from the base of the PR and between 92f371c and 80398ff.

⛔ Files ignored due to path filters (2)
  • sample-apps/react-native/dogfood/ios/Podfile.lock is excluded by !**/*.lock
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • packages/react-native-callingx/package.json
  • packages/react-native-sdk/package.json
  • packages/video-filters-react-native/package.json
  • sample-apps/react-native/dogfood/package.json
  • sample-apps/react-native/expo-video-sample/package.json
  • sample-apps/react-native/ringing-tutorial/package.json
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/react-native-callingx/package.json
  • sample-apps/react-native/ringing-tutorial/package.json
  • packages/video-filters-react-native/package.json
  • packages/react-native-sdk/package.json

📝 Walkthrough

Walkthrough

CallKit audio configuration is applied synchronously while WebRTC engine availability is gated across activation states. React Native activation waiting is removed, audio-session and recording tracing is added, and WebRTC dependency versions and the Yarn allowlist are updated.

Changes

CallKit audio lifecycle

Layer / File(s) Summary
Native CallKit engine flow
packages/react-native-callingx/ios/..., packages/react-native-sdk/ios/StreamInCallManager.swift
CallKit handlers gate ADM availability, synchronously apply configuration, restore availability on activation, and disable it on deactivation. Non-CallKit setup restores default availability.
Remove activation Promise coordination
packages/react-native-sdk/src/utils/internal/callingx/..., packages/react-native-sdk/src/utils/push/setupCallingExpEvents.ts
Callingx call flows no longer wait for audio-session activation, and activation events no longer resolve a pending Promise.
Audio-session and recording tracing
packages/react-native-sdk/src/hooks/push/useCallingExpWithCallingStateEffect.ts
CallKit activation events and delayed iOS ADM recording-state samples are traced with listener, subscription, and timer cleanup.
WebRTC dependency and package configuration
.yarnrc.yml, packages/*/package.json, sample-apps/react-native/*/package.json
WebRTC package versions, peer dependency ranges, and the Yarn preapproved package list are updated.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CallKit
  participant CallingxImpl
  participant AudioSessionManager
  participant AudioDeviceModule
  participant WebRTC
  CallKit->>CallingxImpl: Start or answer call action
  CallingxImpl->>AudioDeviceModule: Disable engine availability
  CallingxImpl->>AudioSessionManager: Apply CallKit configuration synchronously
  CallKit->>CallingxImpl: Activate audio session
  CallingxImpl->>AudioSessionManager: Reapply CallKit configuration
  CallingxImpl->>AudioDeviceModule: Enable engine availability
  CallingxImpl->>WebRTC: Notify activation
  CallKit->>CallingxImpl: Deactivate audio session
  CallingxImpl->>AudioDeviceModule: Disable engine availability
  CallingxImpl->>WebRTC: Notify deactivation
Loading

Possibly related PRs

Suggested reviewers: greenfrvr, jdimovska, oliverlaz

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes an Overview but omits the required Implementation notes, Ticket, and Docs sections. Add the missing template sections with implementation details, the ticket link, and any relevant docs link or note if none exist.
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main CallKit audio activation and timeout removal changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/callkit-audio-activation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

Bundle size

Built package output. Sizes in KB; delta vs main@4fe5c40.

Package Unminified Minified Δ min vs main
@stream-io/video-react-native-sdk 403.1 KB 193.1 KB +465 B (+0.2%)
↳ install total (+ client + react-bindings) 1180.2 KB 466.6 KB +465 B (+0.1%)

@santhoshvai
santhoshvai marked this pull request as ready for review July 28, 2026 09:28

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/react-native-sdk/src/hooks/push/useCallingExpWithCallingStateEffect.ts`:
- Around line 236-251: Wrap the native ADM calls inside traceRecordingState in a
try-catch, including isRecording, isEngineRunning, and isMicrophoneMuted. Handle
any thrown error by logging it through the existing logger and return without
allowing the diagnostics-only callback to propagate an exception; preserve the
current state trace and warning behavior when all calls succeed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0019cfd5-3d9b-4b16-80e0-35f35cf501ab

📥 Commits

Reviewing files that changed from the base of the PR and between f027dba and e55ebdb.

⛔ Files ignored due to path filters (2)
  • sample-apps/react-native/dogfood/ios/Podfile.lock is excluded by !**/*.lock
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (9)
  • .yarnrc.yml
  • packages/react-native-callingx/ios/AudioSessionManager.swift
  • packages/react-native-callingx/ios/CallingxImpl.swift
  • packages/react-native-sdk/ios/StreamInCallManager.swift
  • packages/react-native-sdk/src/hooks/push/useCallingExpWithCallingStateEffect.ts
  • packages/react-native-sdk/src/utils/internal/callingx/audioSessionPromise.ts
  • packages/react-native-sdk/src/utils/internal/callingx/callingx.ts
  • packages/react-native-sdk/src/utils/push/setupCallingExpEvents.ts
  • sample-apps/react-native/dogfood/package.json
💤 Files with no reviewable changes (3)
  • packages/react-native-sdk/src/utils/internal/callingx/audioSessionPromise.ts
  • packages/react-native-sdk/src/utils/push/setupCallingExpEvents.ts
  • packages/react-native-sdk/src/utils/internal/callingx/callingx.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/video-filters-react-native/package.json (1)

51-51: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Align the peer dependency with the required WebRTC version.

Line 60 still allows ^145.0.0, including 145.0.0, while the development dependency now targets 145.1.0. If this package relies on the CallKit/audio fixes in 145.1.0, change the peer range to ^145.1.0; otherwise, confirm why older WebRTC versions remain supported.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/video-filters-react-native/package.json` at line 51, Update the
`@stream-io/react-native-webrtc` peer dependency range to ^145.1.0 so it matches
the development dependency and requires the supported WebRTC fixes; do not
retain compatibility with 145.0.0.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/video-filters-react-native/package.json`:
- Line 51: Update the `@stream-io/react-native-webrtc` peer dependency range to
^145.1.0 so it matches the development dependency and requires the supported
WebRTC fixes; do not retain compatibility with 145.0.0.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: aa59eb64-d749-4c8e-81a4-cf3c2416e726

📥 Commits

Reviewing files that changed from the base of the PR and between cda7254 and 82fd80b.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • packages/react-native-callingx/package.json
  • packages/react-native-sdk/package.json
  • packages/video-filters-react-native/package.json
  • sample-apps/react-native/ringing-tutorial/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/react-native-sdk/package.json

@santhoshvai
santhoshvai merged commit 64d6cff into main Jul 29, 2026
9 checks passed
@santhoshvai
santhoshvai deleted the fix/callkit-audio-activation branch July 29, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants