Fixes for broadcast mode

This commit is contained in:
Sylvain Berfini 2024-02-29 12:16:00 +01:00
parent 6d33515e8e
commit e6eea07da9
2 changed files with 18 additions and 9 deletions

View file

@ -236,13 +236,6 @@ class ConferenceWaitingRoomViewModel : MessageNotifierViewModel() {
) )
val areWeListener = myself.role == Participant.Role.Listener val areWeListener = myself.role == Participant.Role.Listener
isConferenceBroadcastWithListenerRole.value = areWeListener isConferenceBroadcastWithListenerRole.value = areWeListener
if (areWeListener) {
callParams.isVideoEnabled = false
callParams.videoDirection = MediaDirection.Inactive
updateVideoState()
updateLayout()
}
} else { } else {
Log.e( Log.e(
"[Conference Waiting Room] Failed to find ourselves in participants info" "[Conference Waiting Room] Failed to find ourselves in participants info"

View file

@ -107,7 +107,7 @@ class ConferenceViewModel : ViewModel() {
Log.i( Log.i(
"[Conference] Participant device added: ${participantDevice.address.asStringUriOnly()}" "[Conference] Participant device added: ${participantDevice.address.asStringUriOnly()}"
) )
addParticipantDevice(participantDevice) addParticipantDevice(conference, participantDevice)
if (conferenceParticipantDevices.value.orEmpty().size == 2) { if (conferenceParticipantDevices.value.orEmpty().size == 2) {
secondParticipantJoinedEvent.value = Event(true) secondParticipantJoinedEvent.value = Event(true)
@ -628,7 +628,7 @@ class ConferenceViewModel : ViewModel() {
moreThanTwoParticipants.value = devices.size > 2 moreThanTwoParticipants.value = devices.size > 2
} }
private fun addParticipantDevice(device: ParticipantDevice) { private fun addParticipantDevice(conference: Conference, device: ParticipantDevice) {
val devices = arrayListOf<ConferenceParticipantDeviceData>() val devices = arrayListOf<ConferenceParticipantDeviceData>()
devices.addAll(conferenceParticipantDevices.value.orEmpty()) devices.addAll(conferenceParticipantDevices.value.orEmpty())
@ -645,6 +645,22 @@ class ConferenceViewModel : ViewModel() {
Log.i( Log.i(
"[Conference] New participant device found: ${device.name} (${device.address.asStringUriOnly()})" "[Conference] New participant device found: ${device.name} (${device.address.asStringUriOnly()})"
) )
val conferenceInfo = conference.core.findConferenceInformationFromUri(
conference.conferenceAddress
)
val info = conferenceInfo?.participantInfos?.find {
it.address.weakEqual(device.address)
}
if (info != null) {
Log.i("[Conference] New participant role is [${info.role.name}]")
val listener =
info.role == Participant.Role.Listener || info.role == Participant.Role.Unknown
if (listener) {
return
}
}
val deviceData = ConferenceParticipantDeviceData(device, false) val deviceData = ConferenceParticipantDeviceData(device, false)
devices.add(deviceData) devices.add(deviceData)