Skip to main content
Version: 3.x.x

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.
  • selectedAudioDevice is the device in use. It is null only when no audio device is available, for example before VideoSDK.initialize() has run.
  • audioDevices contains every available audio device, including the selected one.
  • Set the listener with room.setAudioDeviceChangeListener(). AudioDeviceChangeEvent is in the live.videosdk.rtc.android.listeners package. It is a fun 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


Was this helpful?

Not helpfulHelpful