Technical Q&A QA1803

AVAudioSession - How setting a category and mode affect the ability to route audio to AirPlay

Q:  How does an application's choice of audio category and mode affect the ability to route audio to AirPlay?

A: The AVAudioSession playback-only categories (AVAudioSessionCategoryAmbient, AVAudioSessionCategorySoloAmbient and AVAudioSessionCategoryPlayback) support both the mirrored and non-mirrored variants of AirPlay.

The AVAudioSession category AVAudioSessionCategoryPlayAndRecord supports only the mirrored variant of AirPlay while the AVAudioSessionCategoryMultiRoute category does not allow routing to AirPlay.

Modes modify the audio category in order to introduce specific tailored behavior. When an application uses the AVAudioSessionModeVoiceChat mode, AirPlay is not allowed. The AVAudioSessionModeVideoChat mode introduced in iOS 7 supports the mirrored variant of AirPlay.

Additionally, setting the AVAudioSessionModeVoiceChat mode will enable the AVAudioSession category option AVAudioSessionCategoryOptionAllowBluetooth, further modifying the behavior of the AVAudioSessionCategoryPlayAndRecord category to allow paired bluetooth hands-free profile (HFP) devices to be used for input and output.

Setting the AVAudioSessionModeVideoChat mode will further modify the behavior of the AVAudioSessionCategoryPlayAndRecord category by setting the AVAudioSessionCategoryOptionAllowBluetooth option and the AVAudioSessionCategoryOptionDefaultToSpeaker option.

See AVAudioSession.h for more information.



Document Revision History


DateNotes
2014-01-15

Editorial

2013-09-17

New document that discusses how setting a AVAudioSession category and mode affect the ability to route audio to AirPlay.