Ios, audio output management problem

Hi,

I’m trying to create an app with Webrtc call.
The calls work perfectly, but I would like to set by default the audio output to phone speaker.
And if there is a bluetooth connection, switch audio on the bluetooth device.
For that I use react-native-incall-manager, on android everything works fine.
But on ios, only the first call works, after the sound doesn’t work anymore.

The problem is known, a solution was proposed but I do not know how to apply it.

I need a help, Thanks for reading me

Don’t use react-native-incall-manager on ios. Instead, just update the AVAudioSession directly from your ApplDelegate.m. Something like this:

#import <WebRTC/RTCAudioSessionConfiguration.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  RTCAudioSessionConfiguration *webRTCConfiguration = [RTCAudioSessionConfiguration webRTCConfiguration];

  webRTCConfiguration.categoryOptions = (AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionDefaultToSpeaker);
}

1 Like