---
title: defaultToSpeaker
framework: avfaudio
role: symbol
role_heading: Type Property
path: avfaudio/avaudiosession/categoryoptions-swift.struct/defaulttospeaker
---

# defaultToSpeaker

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

## Declaration

```swift
static var defaultToSpeaker: AVAudioSession.CategoryOptions { get }
```

## Discussion

Discussion You can set this option only when using the playAndRecord category. Use it to modify the category’s routing behavior so audio is always routed to the speaker rather than the receiver, even when other accessories, such as headphones and wireless Bluetooth headphones, are in use. When using this option, the system doesn’t honor user gestures. For example, plugging in a headset doesn’t cause the route to change to headset mic and headphones, the route remains to the built-in mic and speaker 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 normally goes to the receiver. note: Route changes and interruptions don’t reset this override. Only changing the audio session category resets this option.

## See Also

### Category options

- [allowAirPlay](avfaudio/avaudiosession/categoryoptions-swift.struct/allowairplay.md)
- [allowBluetooth](avfaudio/avaudiosession/categoryoptions-swift.struct/allowbluetooth.md)
- [allowBluetoothA2DP](avfaudio/avaudiosession/categoryoptions-swift.struct/allowbluetootha2dp.md)
- [allowBluetoothHFP](avfaudio/avaudiosession/categoryoptions-swift.struct/allowbluetoothhfp.md)
- [bluetoothHighQualityRecording](avfaudio/avaudiosession/categoryoptions-swift.struct/bluetoothhighqualityrecording.md)
- [duckOthers](avfaudio/avaudiosession/categoryoptions-swift.struct/duckothers.md)
- [farFieldInput](avfaudio/avaudiosession/categoryoptions-swift.struct/farfieldinput.md)
- [interruptSpokenAudioAndMixWithOthers](avfaudio/avaudiosession/categoryoptions-swift.struct/interruptspokenaudioandmixwithothers.md)
- [mixWithOthers](avfaudio/avaudiosession/categoryoptions-swift.struct/mixwithothers.md)
- [overrideMutedMicrophoneInterruption](avfaudio/avaudiosession/categoryoptions-swift.struct/overridemutedmicrophoneinterruption.md)
