Audio Recording not working when bluetooth speaker is connected.
Hi,
I am currently working on a project in which I have to provide the ability to play and record audio. Everything is working fine except when I use a bluetooth speaker. By default in my app, the audio engine is using PlayAndRecord audio session category. When using this audio session category, connected Bluetooth speaker(JBL Pulse, no mic) does not work with the app. So I tried switching the audio session category to Playback using the -setAudioSessionCategory
method of AEAudioController . After switching, playback works but obviously the recording won't work. So I tried to change the category back to PlaybackAndRecord through AEAudioController but it doesn't change to PlaybackAndRecord. After some debugging I observed that in -setAudioSessionCategory, code checks for available input devices. If there is any input device available, then only it switches to PlayAndRecord otherwise to Playback. So If I switch to Playback category and keep the Bluetooth speaker connected and try to switch to PlayAndRecord category, It doesn't work and recording feature doesn't work.
The audio session provides a facility to override output audio port using -overrideOutputAudioPort:
by passing the constant AVAudioSessionPortOverrideSpeaker which only works with PlayAndRecord audio session category and it overrides both the input and output to device's speakers and mic (making Bluetooth speakers to not work).
Is there any solution to this? Thanks in advance.
Comments
Alas, no... iOS is exceptionally dumb when it comes to playing/recording with bluetooth speakers. It's a long-time problem, and there's no solution I'm aware of yet.
You should register a bug report (the more they get, the more likely they'll be to do something about it): http://bugreporter.apple.com
Yes - I had the same issue with iOS and just had to live with it. IOS does not seem to allow bluetooth for output and something else for input - connecting to a bluetooth output device also switches to the bluetooth input. As I remember, you can still record from the bluetooth device (like headphones with a microphone) but the quality is reduced a lot. I have music-related apps and I thought the quality was so low, that I disable input when bluetooth output is needed. Agree that you should report it. I assume one day Apple will fix it.
Yeah, that's right: input does work, but it switches to a low-sample rate mode, presumably designed for telephony. Crappity-crap!