Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AVAudioSessionCategoryPlayAndRecord makes AirPlay invisible

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

like image 594
Anastasia Avatar asked Oct 30 '12 11:10

Anastasia


1 Answers

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?

like image 199
Jonathan Arbogast Avatar answered Nov 05 '22 02:11

Jonathan Arbogast