I am encountering the following problem: AirPlay becomes not available whenever I set play-and-record category to the audio session in my application:
[[AVAudioSession sharedInstance]
setCategory: AVAudioSessionCategoryPlayAndRecord
error: &setCategoryError];
This call makes the AirPlay disappear and reroutes the audio to the speaker immediately.
The problem can be easily reproduced e.g. on the sample project avTouch
from Xcode documentation by replacing AVAudioSessionCategoryPlayback
category with AVAudioSessionCategoryPlayAndRecord
: in the original example AirPlay picker is visible and allows to change output source, whereas with the AVAudioSessionCategoryPlayAndRecord
category the picker disappears.
Is there a proper way to switch to AVAudioSessionCategoryPlayAndRecord
category so that the AirPlay is still available?
(A question like this has been already asked, but didn't get any answer.)
What AirPlay device are you trying to use? Does it have a microphone?
If not, iOS won't present it as an option when using the PlayAndRecord category, because that device can't play and record. It would show up when using the Play category though.
Also, if the device you are using is a Bluetooth device, have you set AVAudioSessionCategoryOptionAllowBluetooth to YES?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With