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.)