VideoSDK Class Events - Android
onAudioDeviceChanged()
- Called when an audio device, such as a wired or Bluetooth headset, is connected or removed, or when the selected audio device changes.
- It is also emitted once as soon as you set the listener, with the current selection and device list.
selectedAudioDeviceis the device in use. It isnullonly when no audio device is available, for example beforeVideoSDK.initialize()has run.audioDevicescontains every available audio device, including the selected one.- Set the listener with
room.setAudioDeviceChangeListener().AudioDeviceChangeEventis in thelive.videosdk.rtc.android.listenerspackage. It is afun interface, so you can pass a lambda. - The listener applies to the whole app, not only to that room: it keeps working after you leave the room, until you set another one or pass
null.
Parameters
- selectedAudioDevice: MicrophoneDeviceInfo?
- audioDevices:
List<MicrophoneDeviceInfo>
Example
room.setAudioDeviceChangeListener { selectedAudioDevice, audioDevices ->
Log.d("VideoSDK", "Selected Audio Device: " + selectedAudioDevice?.label)
for (audioDevice in audioDevices) {
Log.d("VideoSDK", "Audio Devices " + audioDevice.label)
}
}
Got a Question? Ask us on discord

