Agora RTC Objective-C API Reference Refactor

Data Fields
AudioSessionConfiguration Struct Reference

## Data Fields
Optional< bool > | playbackAndRecord
Optional< bool > | chatMode
Optional< bool > | defaultToSpeaker
Optional< bool > | overrideSpeaker
Optional< bool > | allowMixWithOthers
Optional< bool > | allowDuckOthers
Optional< bool > | allowBluetooth
Optional< bool > | allowBluetoothA2DP
Optional< double > | sampleRate
Optional< double > | ioBufferDuration
Optional< int > | inputNumberOfChannels
Optional< int > | outputNumberOfChannels

## Detailed Description

The audio session configurations.

Set these configurations when calling setAudioSessionConfiguration.

## Member Function Documentation

## ◆ SetAll()

void SetAll | ( | const AudioSessionConfiguration & | change | ) |
| inline

## ◆ operator==()

bool operator== | ( | const AudioSessionConfiguration & | o | ) | const
| inline

## ◆ operator!=()

bool operator!= | ( | const AudioSessionConfiguration & | o | ) | const
| inline

## ◆ SetFrom()

static void SetFrom | ( | Optional< T > * | s,
|  | const Optional< T > & | o
| ) |  |
| inline static private

## Field Documentation

## ◆ playbackAndRecord

Optional<bool> 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

Optional<bool> 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

Optional<bool> 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

Optional<bool> 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

Optional<bool> 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

Optional<bool> 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

Optional<bool> 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

Optional<bool> 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

Optional<double> 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

Optional<double> 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

Optional<int> inputNumberOfChannels

The expected number of input audio channels of this session.

## ◆ outputNumberOfChannels

Optional<int> outputNumberOfChannels

The expected number of output audio channels of this session.