0

We are developing a VoIP application. Application is developed using Xamarin.iOS. In order to match iOS calling features, CallKit and AVRoutePickerView are used.

When VOIP call is connected, user try to switch the audio mode from Bluetooth to Earpiece and it is not switching in iOS 15 and above. AirPlay UI also not changing from Bluetooth to Earpiece and audio also not changed to Earpiece. We have added the Category options like AllowBluetoothA2DP for fixing some other issues. Since then Bluetooth to Earpiece switching is not happening. But same code is working fine in iOS 14 and below.

Please provide solution to fix this issue or share cause of this issue may help us to investigate further.

Code: Xamarin iOS

AVAudioSessionCategory category = AVAudioSessionCategory.SoloAmbient;
AVAudioSessionCategoryOptions options = 0;
AVAudioSessionPortOverride port = AVAudioSessionPortOverride.None;
NSString mode = AVAudioSession.ModeDefault;

//When VOIP call gets connected m_active will be true
if (m_active) { 
    mode = AVAudioSession.ModeVoiceChat;
    category = AVAudioSessionCategory.PlayAndRecord;
    options = AVAudioSessionCategoryOptions.AllowBluetooth;
}

//Setting mode and category
AVAudioSession.SharedInstance().SetMode(mode, out err);
AVAudioSession.SharedInstance().SetCategory(category, options | AVAudioSessionCategoryOptions.DuckOthers | AVAudioSessionCategoryOptions.AllowBluetoothA2DP);
AVAudioSession.SharedInstance().OverrideOutputAudioPort(port, out err);
Ranjit
  • 833
  • 8
  • 15
  • I noticed that there was an open issue:[iOS 15 & 16 - AVRoutePickerView - Bluetooth to Earpiece switch is not working](https://developer.apple.com/forums/thread/729954) on Apple Developer Forums, you may follow up there! – Alexandar May - MSFT May 23 '23 at 09:22
  • @AlexandarMay-MSFT that issue was raised by us only. We have not received any response. Hence, we planned to seek support from SO. – Ranjit May 23 '23 at 15:39
  • If Bluetooth to Earpiece switching is not working in iOS 15+ and is working fine in iOS 14-. This could be a potential issue, consider raising an issue on github:https://github.com/xamarin/xamarin-macios/issues – Alexandar May - MSFT May 26 '23 at 07:03
  • @AlexandarMay-MSFT raised an issue on github https://github.com/xamarin/xamarin-macios/issues/18363 – Ranjit May 29 '23 at 13:02

0 Answers0