Conference listener onActiveSpeakerParticipantDevice signature has changed

This commit is contained in:
Sylvain Berfini 2025-01-30 10:55:08 +01:00
parent 5e6186d115
commit 0625239477

View file

@ -134,10 +134,11 @@ class ConferenceViewModel
@WorkerThread @WorkerThread
override fun onActiveSpeakerParticipantDevice( override fun onActiveSpeakerParticipantDevice(
conference: Conference, conference: Conference,
participantDevice: ParticipantDevice participantDevice: ParticipantDevice?
) { ) {
activeSpeaker.value?.isActiveSpeaker?.postValue(false) activeSpeaker.value?.isActiveSpeaker?.postValue(false)
if (participantDevice != null) {
val found = participantDevices.value.orEmpty().find { val found = participantDevices.value.orEmpty().find {
it.device.address.equal(participantDevice.address) it.device.address.equal(participantDevice.address)
} }
@ -151,6 +152,19 @@ class ConferenceViewModel
model.isActiveSpeaker.postValue(true) model.isActiveSpeaker.postValue(true)
activeSpeaker.postValue(model) activeSpeaker.postValue(model)
} }
} else {
Log.w("$TAG Notified active speaker participant device is null, using first one that's not us")
val firstNotUs = participantDevices.value.orEmpty().find {
it.isMe == false
}
if (firstNotUs != null) {
Log.i("$TAG Newly active speaker participant is [${firstNotUs.name}]")
firstNotUs.isActiveSpeaker.postValue(true)
activeSpeaker.postValue(firstNotUs!!)
} else {
Log.i("$TAG No participant device that's not us found, expected if we're alone")
}
}
} }
@WorkerThread @WorkerThread