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

Link copied to clipboard
@Inject
constructor(context: Context)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The audio attribute content type to use when requesting audio focus on devices O and beyond.

Link copied to clipboard

The audio attribute usage type to use when requesting audio focus on devices O and beyond.

Link copied to clipboard
var audioDeviceChangeListener: AudioDeviceChangeListener?

Listen to changes in the available and active audio devices.

Link copied to clipboard

The audio mode to use when requesting audio focus.

Link copied to clipboard

The audio stream type to use when requesting audio focus on pre-O devices.

Link copied to clipboard
val availableAudioDevices: List<AudioDevice>

The available audio devices. This requires calling start before it is populated.

Link copied to clipboard

The audio focus mode to use while started.

Link copied to clipboard

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.

Link copied to clipboard

Toggle whether logging is enabled for AudioSwitch. By default, this is set to false.

Link copied to clipboard

When true, AudioSwitchHandler will request audio focus on start and abandon on stop.

Link copied to clipboard
Link copied to clipboard
var preferredDeviceList: List<Class<out AudioDevice>>?

The preferred priority of audio devices to use. The first available audio device will be used.

Link copied to clipboard
val selectedAudioDevice: AudioDevice?

The currently selected audio device, or null if none (or this handler is not started).

Functions

Link copied to clipboard
fun selectDevice(audioDevice: AudioDevice?)

Select a specific audio device.

Link copied to clipboard
open override fun start()

Called when a room is started.

Link copied to clipboard
open override fun stop()

Called when a room is disconnected.