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,
|
conference: Conference,
|
||||||
participantDevice: ParticipantDevice,
|
participantDevice: ParticipantDevice
|
||||||
isSpeaking: Boolean
|
|
||||||
) {
|
) {
|
||||||
Log.i("[Conference] Participant [${participantDevice.address.asStringUriOnly()}] is ${if (isSpeaking) "speaking" else "not speaking"}")
|
Log.i("[Conference] Participant [${participantDevice.address.asStringUriOnly()}] is currently being displayed as active speaker")
|
||||||
if (isSpeaking) {
|
val device = conferenceParticipantDevices.value.orEmpty().find {
|
||||||
val device = conferenceParticipantDevices.value.orEmpty().find {
|
it.participantDevice.address.weakEqual(participantDevice.address)
|
||||||
it.participantDevice.address.weakEqual(participantDevice.address)
|
}
|
||||||
}
|
if (device != null && device != speakingParticipant.value) {
|
||||||
if (device != null && device != speakingParticipant.value) {
|
Log.i("[Conference] Found actively speaking participant device")
|
||||||
Log.i("[Conference] Found participant device")
|
speakingParticipant.value = device!!
|
||||||
if (!device.isMe) {
|
} else if (device == null) {
|
||||||
// TODO: FIXME: remove, this is a temporary workaround to not have your name
|
Log.w("[Conference] Participant device [${participantDevice.address.asStringUriOnly()}] is the active speaker but couldn't find it in devices list")
|
||||||
// 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")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,6 +421,7 @@ class ConferenceViewModel : ViewModel() {
|
||||||
val devices = arrayListOf<ConferenceParticipantDeviceData>()
|
val devices = arrayListOf<ConferenceParticipantDeviceData>()
|
||||||
|
|
||||||
val participantsList = conference.participantList
|
val participantsList = conference.participantList
|
||||||
|
val activelySpeakingParticipantDevice = conference.activeSpeakerParticipantDevice
|
||||||
Log.i("[Conference] Conference has ${participantsList.size} participants")
|
Log.i("[Conference] Conference has ${participantsList.size} participants")
|
||||||
for (participant in participantsList) {
|
for (participant in participantsList) {
|
||||||
val participantDevices = participant.devices
|
val participantDevices = participant.devices
|
||||||
|
@ -437,11 +431,13 @@ class ConferenceViewModel : ViewModel() {
|
||||||
Log.i("[Conference] Participant device found: ${device.name} (${device.address.asStringUriOnly()})")
|
Log.i("[Conference] Participant device found: ${device.name} (${device.address.asStringUriOnly()})")
|
||||||
val deviceData = ConferenceParticipantDeviceData(device, false)
|
val deviceData = ConferenceParticipantDeviceData(device, false)
|
||||||
devices.add(deviceData)
|
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) {
|
for (device in conference.me.devices) {
|
||||||
Log.i("[Conference] Participant device for myself found: ${device.name} (${device.address.asStringUriOnly()})")
|
Log.i("[Conference] Participant device for myself found: ${device.name} (${device.address.asStringUriOnly()})")
|
||||||
|
|
|
@ -54,7 +54,7 @@ class StatusViewModel : StatusViewModel() {
|
||||||
authenticationToken: String?
|
authenticationToken: String?
|
||||||
) {
|
) {
|
||||||
updateEncryptionInfo(call)
|
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)
|
showZrtpDialogEvent.value = Event(call)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ class StatusViewModel : StatusViewModel() {
|
||||||
if (currentCall != null) {
|
if (currentCall != null) {
|
||||||
updateEncryptionInfo(currentCall)
|
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)
|
showZrtpDialogEvent.value = Event(currentCall)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,11 +120,11 @@ class StatusViewModel : StatusViewModel() {
|
||||||
encryptionContentDescription.value = R.string.content_description_call_secured
|
encryptionContentDescription.value = R.string.content_description_call_secured
|
||||||
}
|
}
|
||||||
MediaEncryption.ZRTP -> {
|
MediaEncryption.ZRTP -> {
|
||||||
encryptionIcon.value = when (call.authenticationTokenVerified) {
|
encryptionIcon.value = when (call.authenticationTokenVerified || call.authenticationToken == null) {
|
||||||
true -> R.drawable.security_ok
|
true -> R.drawable.security_ok
|
||||||
else -> R.drawable.security_pending
|
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
|
true -> R.string.content_description_call_secured
|
||||||
else -> R.string.content_description_call_security_pending
|
else -> R.string.content_description_call_security_pending
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue