Enumeration Case

AVAudioSessionCategoryOptionDefaultToSpeaker

An option that determines whether audio from the session defaults to the built-in speaker instead of the receiver.

Declaration

AVAudioSessionCategoryOptionDefaultToSpeaker = 0x8

Discussion

You can set this option can only when using the AVAudioSessionCategoryPlayAndRecord category. It’s used to modify the category’s routing behavior so that audio is always routed to the speaker rather than the receiver if no other accessories, such as headphones, are in use.

When using this option, the system honors user gestures. For example, plugging in a headset causes the route to change to headset mic/headphones, and unplugging the headset causes the route to change to built-in mic/speaker (as opposed to built-in mic/receiver) when you’ve set this override.

In the case of using a USB input-only accessory, audio input comes from the accessory, and the system routes audio to the headphones, if attached, or to the speaker if the headphones aren’t plugged in. The use case is to route audio to the speaker instead of the receiver in cases where the audio would normally go to the receiver.

See Also

Audio Session Options

AVAudioSessionCategoryOptionMixWithOthers

An option that indicates whether audio from this session mixes with audio from active sessions in other audio apps.

AVAudioSessionCategoryOptionDuckOthers

An option that reduces the volume of other audio session while audio from this session plays.

AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers

An option that determines whether to pause spoken audio content from other sessions when your app plays its audio.

AVAudioSessionCategoryOptionAllowBluetooth

An option that determines whether Bluetooth hands-free devices appear as available input routes.

AVAudioSessionCategoryOptionAllowBluetoothA2DP

An option that determines whether you can stream audio from this session to Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP).

AVAudioSessionCategoryOptionAllowAirPlay

An option that determines whether you can stream audio from this session to AirPlay devices.