3

我有一个通过 AVAudioSession 播放音频(有时通过蓝牙)的应用程序,我写了这段代码

if (IOS10ANDMORE) {
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker |  AVAudioSessionCategoryOptionAllowBluetoothA2DP | AVAudioSessionCategoryOptionAllowBluetooth error:nil];
} else {
     [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker |  AVAudioSessionCategoryOptionAllowBluetooth error:nil];
}

所以 iOS10 和 iOS<10 都可以工作(如果你不使用 AVAudioSessionCategoryOptionAllowBluetoothA2DPiOS10,通过蓝牙的声音很糟糕,但你不能在 iOS<10 上使用它,因为它是随 iOS10 SDK 引入的)

我的问题是,如果我有一部装有 iOS10 的 iPhone,但我使用的是不支持 A2DP 的蓝牙音箱,会发生什么?它会起作用吗?我没有找到关于有多少扬声器支持/不支持 A2DP 的任何数字。

谢谢你的帮助!

4

0 回答 0