3

I have an app that plays audio (sometimes via bluetooth) via AVAudioSession, I wrote this code

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

So both iOS10 and iOS<10 are working (if you don't use AVAudioSessionCategoryOptionAllowBluetoothA2DP with iOS10 the sound is very bad via bluetooth, but you can't use it with iOS<10 because it has been introduced with iOS10 SDK)

My question is what happens if I have an iPhone with iOS10 but I'm using a bluetooth speaker that doesn't support A2DP? Will it work? I didn't find any numbers on how many speakers did/didn't support A2DP.

Thanks for your help!

nommis
  • 116
  • 10
  • I guess it won't distribute the audio to it, but my question is more what profile does it use instead of A2DP, and if it "even works" with the iPhone (with Music.app for instance). – Larme Nov 15 '16 at 16:56
  • 1
    Dear nommis, on Bluetooth sound is transferred via two profiles, one is HFP which is a very low quality sound used for telephone calls and other is A2DP which is used for high quality audio. Your speaker has to have one of these to support audio. All The new speakers contain A2DP profile and optionally HFP profile. If however, you find a speKer which does not have A2DP then your code should fail with that device because it says that it alllows A2DP – aksonlyaks Nov 16 '16 at 13:50

0 Answers0