sinch-rtc

# AudioController

interface AudioController

Controls different audio settings. This object is only valid while the connected SinchClient is started. As soon as the SinchClient is stopped, it is invalidated and must not be used.

By default Sinch SDK does not try to force any specific audio device for input or output or adjust volume levels. That means that if you don't interact with AudioController or Android AudioManager it's the OS that decides which device to use based on:

- AudioManager.MODE_IN_COMMUNICATION that is set internally by the SDK during the time the call is established.

- AudioManager.STREAM_VOICE_CALL being the type of the stream the audio is played on.

You have several options to manipulate this behavior:

1. Use enableSpeaker / disableSpeaker methods (see method specific docs for more information).

2. Use enableAutomaticAudioRouting to allow the SDK to select automatically the communication device.

3. Implement your own logic based on callbacks SDK provides and interacting with Android AudioManager directly.

#### See also

SinchClient.audioController

## Types

AudioRoutingConfig
Link copied to clipboard
data class AudioRoutingConfig(val useSpeakerphoneState: AudioController.UseSpeakerphone, val isBluetoothAudioManaged: Boolean)

Automatic routing configuration data.

UseSpeakerphone
Link copied to clipboard
enum UseSpeakerphone : Enum<AudioController.UseSpeakerphone>

## Functions

disableAutomaticAudioRouting
Link copied to clipboard
abstract fun disableAutomaticAudioRouting()

Disables automatic audio routing (AAR). When AAR is disabled use AudioController.enableSpeaker to toggle between speakerphone and earpiece.

disableSpeaker
Link copied to clipboard
abstract fun disableSpeaker()

Disables speaker mode.

enableAutomaticAudioRouting
Link copied to clipboard
abstract fun enableAutomaticAudioRouting(audioRoutingConfig: AudioController.AudioRoutingConfig)

Enables automatic audio routing between earpiece, speakerphone, wired headset and bluetooth audio devices. Priorities are following:

enableSpeaker
Link copied to clipboard
abstract fun enableSpeaker()

Enables speaker mode.

mute
Link copied to clipboard
abstract fun mute()

Mutes audio input.

setLocalAudioListener
Link copied to clipboard
abstract fun setLocalAudioListener(listener: LocalAudioListener?)

Sets a listener for the local audio listener.

unmute
Link copied to clipboard
abstract fun unmute()

Unmutes audio input.

## Properties

isAutomaticAudioRoutingEnabled
Link copied to clipboard
abstract val isAutomaticAudioRoutingEnabled: Boolean

Indicates whether the automatic audio routing is enabled.

isMute
Link copied to clipboard
abstract val isMute: Boolean

Indicates whether the microphone is muted.

isSpeakerOn
Link copied to clipboard
abstract val isSpeakerOn: Boolean

Indicates whether the speaker is enabled.