MicrophoneManager

class MicrophoneManager(val mediaManager: MediaManagerImpl, val audioUsage: Int, val audioUsageProvider: () -> Int)

The Microphone manager makes it easy to use your microphone in a call

Samples

Constructors

Link copied to clipboard
constructor(mediaManager: MediaManagerImpl, audioUsage: Int, audioUsageProvider: () -> Int)

Properties

Link copied to clipboard
val audioBitrateProfile: StateFlow<ERROR CLASS: Symbol not found for AudioBitrateProfile>

The audio bitrate profile currently in force — observe this to drive a music/voice toggle.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val devices: StateFlow<List<StreamAudioDevice>>

List of available devices.

Link copied to clipboard
val isEnabled: StateFlow<Boolean>

Represents whether the audio is enabled

Link copied to clipboard
Link copied to clipboard

Currently selected device

Link copied to clipboard

The currently selected USB input device, or null if using default routing.

Link copied to clipboard
val status: StateFlow<DeviceStatus>

The status of the audio

Link copied to clipboard

List of detected USB audio input devices.

Functions

Link copied to clipboard
Link copied to clipboard
fun cleanup()
Link copied to clipboard

Clears the USB device selection, restoring default audio routing.

Link copied to clipboard
fun disable(fromUser: Boolean = true)

Disable the audio track. Audio is still captured, but not send. This allows for the "you are muted" toast to indicate you are talking while muted

Link copied to clipboard

List the devices, returns a stateflow with audio devices

Link copied to clipboard

Lists all detected USB input devices.

Link copied to clipboard
fun pause(fromUser: Boolean = true)
Link copied to clipboard
fun resume(fromUser: Boolean = true)
Link copied to clipboard

Select a specific device

Link copied to clipboard

Selects a USB input device as the preferred audio input source.

Link copied to clipboard
suspend fun setAudioBitrateProfile(profile: ERROR CLASS: Symbol not found for AudioBitrateProfile): Result<Unit>

Sets the audio bitrate profile, before joining or on a running call, so a broadcaster who starts playing music can switch to MUSIC_HIGH_QUALITY without rejoining.

Link copied to clipboard
fun setEnabled(enabled: Boolean, fromUser: Boolean = true)

Enable or disable the microphone

Link copied to clipboard

Sets up USB audio device detection using Android's AudioDeviceCallback.