fix: sync callkit audio config with webrtc config#2095
fix: sync callkit audio config with webrtc config#2095greenfrvr merged 14 commits intofeat/callkit-telecom-integrationfrom
Conversation
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
📝 WalkthroughWalkthroughThe PR integrates WebRTC audio session management into the calling packages. It adds the stream-react-native-webrtc dependency, refactors AudioSessionManager to use RTCAudioSession APIs instead of manual AVAudioSession configuration, forwards CallKit lifecycle events from CallingxImpl to RTCAudioSession, adds conditional bypass logic in StreamInCallManager when CallingX is active, and removes redundant audio session event handling from setupCallingExpEvents. Changes
Sequence DiagramsequenceDiagram
participant CallKit
participant CallingxImpl
participant RTCAudioSession
participant StreamInCallManager
participant AVAudioSession
CallKit->>CallingxImpl: didActivate audioSession
CallingxImpl->>RTCAudioSession: audioSessionDidActivate()
CallingxImpl->>AVAudioSession: manage idle timer
CallingxImpl->>CallingxImpl: emit didActivateAudioSession
Note over StreamInCallManager: registerSDKGlobals checks<br/>shouldBypassForCallKit()
alt CallingX is managing audio
StreamInCallManager->>StreamInCallManager: bypass setup/start/stop
else CallingX inactive
StreamInCallManager->>RTCAudioSession: apply WebRTC config
RTCAudioSession->>AVAudioSession: configure sample rate & IO buffer
end
CallKit->>CallingxImpl: didDeactivate audioSession
CallingxImpl->>RTCAudioSession: audioSessionDidDeactivate()
CallingxImpl->>AVAudioSession: restore idle timer
CallingxImpl->>CallingxImpl: emit didDeactivateAudioSession
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
…' into audio-callkit # Conflicts: # packages/react-native-callingx/ios/CallingxImpl.swift
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/react-native-callingx/ios/AudioSessionManager.swift (1)
3-39: RTCAudioSessionConfiguration API is not available in stream-react-native-webrtc v137.x—refactor to use AVAudioSession directly or Stream's callManager.
RTCAudioSessionConfigurationwas removed in react-native-webrtc 111.x and is not present in v137.x. The calls toRTCAudioSessionConfiguration.webRTC(),.setWebRTC(), and related configuration will fail at runtime.Two recommended approaches:
- Use Stream's
callManager(preferred): configure audio viacallManager.start({ audioRole: "communicator", deviceEndpointType: "speaker" })andcallManager.stop(). This is Stream SDK's supported pattern and avoids manual WebRTC audio management.- Use
AVAudioSessiondirectly (if manual control is required): configure category, mode, and options onAVAudioSession.sharedInstance()and set active state appropriately for background operation. Avoid the removedRTCAudioSessionConfigurationAPI entirely.Additionally, ensure background audio capability is enabled in
Info.plist(Background Modes: Audio, AirPlay, and Picture in Picture) to maintain the audio connection in background as mentioned in the design notes.
🤖 Fix all issues with AI agents
In `@packages/react-native-sdk/src/utils/internal/registerSDKGlobals.ts`:
- Around line 30-49: Wrap each call to StreamInCallManagerNativeModule in
try/catch so native errors don’t bubble up: in the setup, start, and stop
methods (while keeping the shouldBypassForCallKit() early-return) surround calls
to setDefaultAudioDeviceEndpointType and setup inside a try/catch in setup, and
wrap StreamInCallManagerNativeModule.start() and
StreamInCallManagerNativeModule.stop() each in their own try/catch; on catch,
log a non-fatal warning (e.g., console.warn or processLogger.warn) with a clear
tag like "[StreamInCallManager.<method>]" and the error, then continue.
packages/react-native-sdk/src/utils/internal/registerSDKGlobals.ts
Outdated
Show resolved
Hide resolved
This reverts commit 304c9f7.
…ew (#2093) ### 💡 Overview This PR fixes an issue where the screen share overlay styling was applied to camera thumbnails of participants sharing their screen, so it now only affects the screen share track. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Enhanced screen-share track detection in debug participant views for more accurate display state identification. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
…2092) Switch to `partialUpdateUser`, as `upsertUser` seems to be overwriting previously set custom props.
…2096) ### 💡 Overview This PR aligns the default audio output device selection from server settings as per native [iOS SDK](https://github.com/GetStream/stream-video-swift/blob/12c2342e62a7d5d1f2f3516b57843bf367d3ea53/Sources/StreamVideo/Models/Extensions/CallSettingsResponse%2BSettingsPriority.swift#L19). ### 📝 Implementation notes ``` /// The priority order is as follows: /// 1. If video camera is set to be on by default, speaker is enabled /// 2. If audio speaker is set to be on by default, speaker is enabled /// 3. If the default audio device is set to speaker, speaker is enabled ``` 🎫 Ticket: https://linear.app/stream/issue/RN-338 📑 Docs: https://github.com/GetStream/docs-content/pull/<id> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Enhanced audio device configuration management within the SDK. * Improved consistency in audio output device selection handling. * Optimized internal device setup processes for better maintainability. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2e40ee5 to
6670ac8
Compare
Overview
When CallKit activates the audio session and we must forward this via
audioSessionDidActivate, WebRTC:isActive = YESThis ensures WebRTC knows the session is already active and won't try to activate it again.
In this PR, we ensure that callkit audio config matches with our intended webrtc audio config. To avoid clashes and that webrtc audio unit always starts/resumes.
Why this matters:
RTCAudioSessionConfiguration.webRTC()AVAudioSessiondirectly without updating WebRTC's stored config, there could be mismatches during audio route changes or interruptionsSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.