AudioSwitchHandler

@Singleton()
class AudioSwitchHandler @Inject() constructor(context: Context) : AudioHandler

An AudioHandler built on top of AudioSwitch.

The various settings should be set before connecting to a Room and start is called.

Constructors

AudioSwitchHandler
Link copied to clipboard
@Inject()
fun AudioSwitchHandler(context: Context)

Types

Companion
Link copied to clipboard
object Companion

Functions

selectDevice
Link copied to clipboard
fun selectDevice(audioDevice: AudioDevice?)
Select a specific audio device.
start
Link copied to clipboard
open override fun start()
Called when a room is started.
stop
Link copied to clipboard
open override fun stop()
Called when a room is disconnected.

Properties

audioAttributeContentType
Link copied to clipboard
var audioAttributeContentType: Int
The audio attribute content type to use when requesting audio focus on devices O and beyond.
audioAttributeUsageType
Link copied to clipboard
var audioAttributeUsageType: Int
The audio attribute usage type to use when requesting audio focus on devices O and beyond.
audioDeviceChangeListener
Link copied to clipboard
var audioDeviceChangeListener: AudioDeviceChangeListener? = null
Listen to changes in the available and active audio devices.
audioMode
Link copied to clipboard
var audioMode: Int
The audio mode to use when requesting audio focus.
audioStreamType
Link copied to clipboard
var audioStreamType: Int
The audio stream type to use when requesting audio focus on pre-O devices.
availableAudioDevices
Link copied to clipboard
val availableAudioDevices: List<AudioDevice>
The available audio devices.
focusMode
Link copied to clipboard
var focusMode: Int
The audio focus mode to use while started.
forceHandleAudioRouting
Link copied to clipboard
var forceHandleAudioRouting: Boolean = false
On certain Android devices, audio routing does not function properly and bluetooth microphones will not work unless audio mode is set to AudioManager.MODE_IN_COMMUNICATION or AudioManager.MODE_IN_CALL.
loggingEnabled
Link copied to clipboard
var loggingEnabled: Boolean = false
Toggle whether logging is enabled for AudioSwitch.
manageAudioFocus
Link copied to clipboard
var manageAudioFocus: Boolean = true
When true, AudioSwitchHandler will request audio focus on start and abandon on stop.
onAudioFocusChangeListener
Link copied to clipboard
Listen to changes in audio focus.
preferredDeviceList
Link copied to clipboard
var preferredDeviceList: List<Class<out AudioDevice>>? = null
The preferred priority of audio devices to use.
selectedAudioDevice
Link copied to clipboard
val selectedAudioDevice: AudioDevice?
The currently selected audio device, or null if none (or this handler is not started).

Sources

SDK source
Link copied to clipboard