Keep bluetooth sound when initializing AVAudioSession

后端 未结 2 1639
面向向阳花
面向向阳花 2020-12-06 18:28

I\'m about to go crazy.

I have a recording app. I\'m running into a problem that when I open my app, if i\'m listening to music on a bluetooth device, it gets autom

相关标签:
2条回答
  • 2020-12-06 18:50

    With iOS 10, Apple added the option AVAudioSessionCategoryOptionAllowBluetoothA2DP. They also changed the meaning of AudioSessionCategoryOptionAllowBluetooth to only allow output using the HFP Bluetooth profile, which is where you get the low quality audio output.

    If you use this new option in place of the AudioSessionCategoryOptionAllowBluetooth option in your code snippet, it will allow high quality output but disallow low quality audio output.

    Here's the online documentation for the options, but unfortunately there's no description for the new iOS 10 options online. You can see more detail in the in-code documentation for AVAudioSession.h. https://developer.apple.com/reference/avfoundation/avaudiosessioncategoryoptions?language=objc

    0 讨论(0)
  • 2020-12-06 18:53

    Unfortunately I got this answer directly from Apple Technical Support

    There is no supported way to achieve the desired functionality given the currently shipping system configurations. If you would like for Apple to consider adding support for such features in the future, please submit an enhancement request via the Bug Reporter tool at http://bugreport.apple.com.

    So that's it...

    0 讨论(0)
提交回复
热议问题