Search code examples
objective-cwebrtcavplayervoip

AVPlayer blocks Voip or webrtc in iOS


During a P2P video call I play an mp3 url using AVPlayer, the mp3 plays but the voice of remote and local audio is gone. So I need to disconnect headphone and reconnect again.

What should I do? I even use

NSError *error;

AVAudioSession *session = [AVAudioSession sharedInstance];

[session setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];

[session setMode:AVAudioSessionModeVoiceChat error:&error];

[session setActive:YES error:&error];

But still no luck. What work around should I use?


Solution

  • Try creating new object of AVAudioSession, don't use sharedInstance of AVAudioSession and then check.