Using new callback to display the correct active speaker participant device name
This commit is contained in:
parent
dd1ec48cbd
commit
59a9290832
2 changed files with 21 additions and 25 deletions
|
@ -167,26 +167,19 @@ class ConferenceViewModel : ViewModel() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onParticipantDeviceIsSpeakingChanged(
|
||||
override fun onActiveSpeakerParticipantDevice(
|
||||
conference: Conference,
|
||||
participantDevice: ParticipantDevice,
|
||||
isSpeaking: Boolean
|
||||
participantDevice: ParticipantDevice
|
||||
) {
|
||||
Log.i("[Conference] Participant [${participantDevice.address.asStringUriOnly()}] is ${if (isSpeaking) "speaking" else "not speaking"}")
|
||||
if (isSpeaking) {
|
||||
val device = conferenceParticipantDevices.value.orEmpty().find {
|
||||
it.participantDevice.address.weakEqual(participantDevice.address)
|
||||
}
|
||||
if (device != null && device != speakingParticipant.value) {
|
||||
Log.i("[Conference] Found participant device")
|
||||
if (!device.isMe) {
|
||||
// TODO: FIXME: remove, this is a temporary workaround to not have your name
|
||||
// displayed above someone else video in active speaker layout when you talk
|
||||
speakingParticipant.value = device!!
|
||||
}
|
||||
} else if (device == null) {
|
||||
Log.w("[Conference] Participant device [${participantDevice.address.asStringUriOnly()}] is speaking but couldn't find it in devices list")
|
||||
}
|
||||
Log.i("[Conference] Participant [${participantDevice.address.asStringUriOnly()}] is currently being displayed as active speaker")
|
||||
val device = conferenceParticipantDevices.value.orEmpty().find {
|
||||
it.participantDevice.address.weakEqual(participantDevice.address)
|
||||
}
|
||||
if (device != null && device != speakingParticipant.value) {
|
||||
Log.i("[Conference] Found actively speaking participant device")
|
||||
speakingParticipant.value = device!!
|
||||
} else if (device == null) {
|
||||
Log.w("[Conference] Participant device [${participantDevice.address.asStringUriOnly()}] is the active speaker but couldn't find it in devices list")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,6 +421,7 @@ class ConferenceViewModel : ViewModel() {
|
|||
val devices = arrayListOf<ConferenceParticipantDeviceData>()
|
||||
|
||||
val participantsList = conference.participantList
|
||||
val activelySpeakingParticipantDevice = conference.activeSpeakerParticipantDevice
|
||||
Log.i("[Conference] Conference has ${participantsList.size} participants")
|
||||
for (participant in participantsList) {
|
||||
val participantDevices = participant.devices
|
||||
|
@ -437,11 +431,13 @@ class ConferenceViewModel : ViewModel() {
|
|||
Log.i("[Conference] Participant device found: ${device.name} (${device.address.asStringUriOnly()})")
|
||||
val deviceData = ConferenceParticipantDeviceData(device, false)
|
||||
devices.add(deviceData)
|
||||
|
||||
if (activelySpeakingParticipantDevice == device) {
|
||||
Log.i("[Conference] Actively speaking participant device found: ${device.name} (${device.address.asStringUriOnly()})")
|
||||
speakingParticipant.value = deviceData
|
||||
}
|
||||
}
|
||||
}
|
||||
if (devices.isNotEmpty()) {
|
||||
speakingParticipant.value = devices.first()
|
||||
}
|
||||
|
||||
for (device in conference.me.devices) {
|
||||
Log.i("[Conference] Participant device for myself found: ${device.name} (${device.address.asStringUriOnly()})")
|
||||
|
|
|
@ -54,7 +54,7 @@ class StatusViewModel : StatusViewModel() {
|
|||
authenticationToken: String?
|
||||
) {
|
||||
updateEncryptionInfo(call)
|
||||
if (call.currentParams.mediaEncryption == MediaEncryption.ZRTP && !call.authenticationTokenVerified) {
|
||||
if (call.currentParams.mediaEncryption == MediaEncryption.ZRTP && !call.authenticationTokenVerified && call.authenticationToken != null) {
|
||||
showZrtpDialogEvent.value = Event(call)
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ class StatusViewModel : StatusViewModel() {
|
|||
if (currentCall != null) {
|
||||
updateEncryptionInfo(currentCall)
|
||||
|
||||
if (currentCall.currentParams.mediaEncryption == MediaEncryption.ZRTP && !currentCall.authenticationTokenVerified) {
|
||||
if (currentCall.currentParams.mediaEncryption == MediaEncryption.ZRTP && !currentCall.authenticationTokenVerified && currentCall.authenticationToken != null) {
|
||||
showZrtpDialogEvent.value = Event(currentCall)
|
||||
}
|
||||
}
|
||||
|
@ -120,11 +120,11 @@ class StatusViewModel : StatusViewModel() {
|
|||
encryptionContentDescription.value = R.string.content_description_call_secured
|
||||
}
|
||||
MediaEncryption.ZRTP -> {
|
||||
encryptionIcon.value = when (call.authenticationTokenVerified) {
|
||||
encryptionIcon.value = when (call.authenticationTokenVerified || call.authenticationToken == null) {
|
||||
true -> R.drawable.security_ok
|
||||
else -> R.drawable.security_pending
|
||||
}
|
||||
encryptionContentDescription.value = when (call.authenticationTokenVerified) {
|
||||
encryptionContentDescription.value = when (call.authenticationTokenVerified || call.authenticationToken == null) {
|
||||
true -> R.string.content_description_call_secured
|
||||
else -> R.string.content_description_call_security_pending
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue