Fixed displayer screen sharing participant name

This commit is contained in:
Sylvain Berfini 2025-10-15 16:20:48 +02:00
parent d60d19970f
commit 7b33ff05cd
3 changed files with 20 additions and 2 deletions

View file

@ -68,6 +68,8 @@ class ConferenceViewModel
val conferenceLayout = MutableLiveData<Int>()
val screenSharingParticipantName = MutableLiveData<String>()
val isScreenSharing = MutableLiveData<Boolean>()
val isPaused = MutableLiveData<Boolean>()
@ -237,7 +239,17 @@ class ConferenceViewModel
"$TAG Participant device [${device.address.asStringUriOnly()}] is ${if (enabled) "sharing it's screen" else "no longer sharing it's screen"}"
)
isScreenSharing.postValue(enabled)
if (enabled) {
val deviceModel = participantDevices.value.orEmpty().find {
it.device == device || device.address.weakEqual(it.device.address)
}
if (deviceModel != null) {
screenSharingParticipantName.postValue(deviceModel.name)
} else {
Log.w("$TAG Failed to find screen sharing participant device model!")
}
val call = conference.call
if (call != null) {
val currentLayout = getCurrentLayout(call)
@ -250,6 +262,8 @@ class ConferenceViewModel
} else {
Log.e("$TAG Screen sharing was enabled but conference's call is null!")
}
} else {
screenSharingParticipantName.postValue("")
}
}
@ -574,6 +588,10 @@ class ConferenceViewModel
activeSpeaker.postValue(model)
activeSpeakerParticipantDeviceFound = true
}
if (device == conference.screenSharingParticipantDevice) {
Log.i("$TAG Using participant is [${model.name}] as current screen sharing sender")
screenSharingParticipantName.postValue(model.name)
}
}
}
}

View file

@ -110,7 +110,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginBottom="10dp"
android:text="@{conferenceViewModel.activeSpeaker.name, default=`John Doe`}"
android:text="@{conferenceViewModel.isScreenSharing ? conferenceViewModel.screenSharingParticipantName : conferenceViewModel.activeSpeaker.name, default=`John Doe`}"
android:textColor="@color/bc_white"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -109,7 +109,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginBottom="10dp"
android:text="@{conferenceViewModel.activeSpeaker.name, default=`John Doe`}"
android:text="@{conferenceViewModel.isScreenSharing ? conferenceViewModel.screenSharingParticipantName : conferenceViewModel.activeSpeaker.name, default=`John Doe`}"
android:textColor="@color/bc_white"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@id/active_speaker_miniatures_horizontal_layout"