aws / amazon-chime-sdk-android

An Android client library for integrating multi-party communications powered by the Amazon Chime service.
https://aws.amazon.com/chime/chime-sdk/
Apache License 2.0
105 stars 49 forks source link

Choose an audio device by passing a MediaDevice object. #575

Closed daman-preet closed 11 months ago

daman-preet commented 1 year ago

How to write this code in android studio

// Filter out OTHER type which is currently not supported for selection val audioDevices = meetingSession.audioVideo.listAudioDevices().filter { it.type != MediaDeviceType.OTHER) } val device = / An item from audioDevices / meetingSession.audioVideo.chooseAudioDevice(device)

hokyungh commented 1 year ago

Do you mean how to get it as working code? Could you try and see if following code snippet works?

// Filter out OTHER type which is currently not supported for selection
val audioDevices = meetingSession.audioVideo.listAudioDevices().filter {
it.type != MediaDeviceType.OTHER)
}.sortedBy { it.order }
val device = audioDevices.firstOfNull()
device?.let {meetingSession.audioVideo.chooseAudioDevice(it)}