The audio session configurations.
Set these configurations when calling setAudioSessionConfiguration.
◆ SetAll()
◆ operator==()
◆ operator!=()
◆ SetFrom()
◆ playbackAndRecord
Whether to enable audio input (recording) and audio output (playback):
true: Enable audio recording and playback.
false: Disable audio recording and playback, which prevents audio input and output.
- Note
- For the recording function to work, the user must grant permission for audio recording.
- By default, the audio of your app is nonmixable, which means activating audio sessions in your app interrupts other nonmixable audio sessions. Set
allowMixWithOthers as true to allow audio mixing.
◆ chatMode
Whether to enable chat mode:
true: Enable chat mode. This mode is for apps that are engaged in two-way real-time communication, such as a voice or video chat.
false: Disable chat mode.
For a video chat, set this member as true and set the audio route to the speaker.
◆ defaultToSpeaker
Whether the audio defaults to the built-in speaker:
true: The audio defaults to the built-in speaker.
false: The audio does not default to the built-in speaker.
- Note
- This member is available only when
playbackAndRecord is set as true.
◆ overrideSpeaker
Whether to temporarily change the current audio route to the built-in speaker:
true: Set the current audio route to the built-in speaker.
false: Do not set the current audio route to the built-in speaker.
- Note
- This member is available only when the
playbackAndRecord member is set as true.
◆ allowMixWithOthers
Whether to mix the audio from this session with the audio from active audio sessions in other apps.
true: Mix the audio sessions.
false: Do not mix the audio session.
- Note
- This member is available only when the
playbackAndRecord member is set as true.
◆ allowDuckOthers
Whether to duck the audio from this session with the audio from active audio sessions in other apps.
true: Duck the audio sessions.
false: Do not duck the audio session.
- Note
- This member is available only when the
playbackAndRecord member is set as true.
◆ allowBluetooth
Whether to allow Bluetooth handsfree devices to appear as available audio input devices:
true: Allow Bluetooth handsfree devices to appear as available audio input routes.
false: Do not allow Bluetooth handsfree devices to appear as available audio input routes.
- Note
- This member is available only when the
playbackAndRecord member is set as true.
◆ allowBluetoothA2DP
Whether to allow the audio from this session to be routed to Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP).
true: Allow the audio from this session to be routed to Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP).
false: Do not allow the audio from this session to be routed to Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP).
- Note
- This member is available only when the
playbackAndRecord member is set as true.
◆ sampleRate
The expected audio sample rate (kHz) of this session.
The value range is [8,48]. The actual sample rate may differ based on the audio sampling device in use.
◆ ioBufferDuration
The expected input and output buffer duration (ms) of this session.
The value range is [0,93]. The actual I/O buffer duration might be lower than the set value based on the hardware in use.
◆ inputNumberOfChannels
The expected number of input audio channels of this session.
◆ outputNumberOfChannels
The expected number of output audio channels of this session.