File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -382,7 +382,11 @@ connection while in the background. The example uses
382382[ react-native-callkeep] ( https://github.com/react-native-webrtc/react-native-callkeep )
383383for simple integration with CallKit.
384384
385- Our example code can be found [ here] ( https://github.com/livekit/client-sdk-react-native/blob/main/example/src/callservice/CallService.android.ts ) .
385+ Our example code can be found [ here] ( https://github.com/livekit/client-sdk-react-native/blob/main/example/src/callservice/CallService.ios.ts ) .
386+
387+ For apps planning to use CallKit to handle incoming calls in the background, [ it is important to call
388+ ` RTCAudioSession.audioSessionDidActivate/Deactivate ` when the call provider activates/deactivates
389+ the audio session.] ( https://github.com/livekit/react-native-webrtc/blob/master/Documentation/iOSInstallation.md#callkit )
386390
387391## Troubleshooting
388392
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import RNCallKeep, {
55 AudioSessionMode ,
66} from 'react-native-callkeep' ;
77
8+ import { RTCAudioSession } from '@livekit/react-native-webrtc' ;
9+
810let uuid = '1932b99c-4fe1-4bf4-897f-763bc4dc21c2' ;
911
1012// This keeps the app alive in the background.
@@ -50,5 +52,13 @@ export function setupCallService() {
5052 } ,
5153 } ;
5254 RNCallKeep . setSettings ( options ) ;
53- RNCallKeep . addEventListener ( 'didChangeAudioRoute' , ( ) => { } ) ;
55+ RNCallKeep . addEventListener ( 'didChangeAudioRoute' , ( ) => { } ) ; // To quell warnings.
56+
57+ // For apps handling incoming calls from the background.
58+ RNCallKeep . addEventListener ( 'didActivateAudioSession' , ( ) => {
59+ RTCAudioSession . audioSessionDidActivate ( ) ;
60+ } ) ;
61+ RNCallKeep . addEventListener ( 'didDeactivateAudioSession' , ( ) => {
62+ RTCAudioSession . audioSessionDidDeactivate ( ) ;
63+ } ) ;
5464}
You can’t perform that action at this time.
0 commit comments