diff --git a/app/src/main/java/org/linphone/activities/main/conference/data/ScheduledConferenceData.kt b/app/src/main/java/org/linphone/activities/main/conference/data/ScheduledConferenceData.kt index 3f334bef0..13d7aaa51 100644 --- a/app/src/main/java/org/linphone/activities/main/conference/data/ScheduledConferenceData.kt +++ b/app/src/main/java/org/linphone/activities/main/conference/data/ScheduledConferenceData.kt @@ -163,16 +163,12 @@ class ScheduledConferenceData(val conferenceInfo: ConferenceInfo, private val is val address = participant.asStringUriOnly() participantsListShort += "$name, " when (info.role) { - Participant.Role.Speaker -> { - speakersListExpanded += "$name ($address)\n" - } Participant.Role.Listener -> { participantsListExpanded += "$name ($address)\n" allSpeaker = false } - else -> { // For meetings created before 5.3 SDK - participantsListExpanded += "$name ($address)\n" - allSpeaker = false + else -> { // For meetings created before 5.3 SDK, a speaker might be Unknown + speakersListExpanded += "$name ($address)\n" } } } diff --git a/app/src/main/java/org/linphone/activities/voip/viewmodels/ConferenceViewModel.kt b/app/src/main/java/org/linphone/activities/voip/viewmodels/ConferenceViewModel.kt index b71ef274f..42d31c16a 100644 --- a/app/src/main/java/org/linphone/activities/voip/viewmodels/ConferenceViewModel.kt +++ b/app/src/main/java/org/linphone/activities/voip/viewmodels/ConferenceViewModel.kt @@ -58,6 +58,7 @@ class ConferenceViewModel : ViewModel() { val speakingParticipantFound = MutableLiveData() val speakingParticipant = MutableLiveData() + val speakingParticipantVideoEnabled = MutableLiveData() val meParticipant = MutableLiveData() val isBroadcast = MutableLiveData() @@ -128,6 +129,7 @@ class ConferenceViewModel : ViewModel() { when (conferenceParticipantDevices.value.orEmpty().size) { 1 -> { speakingParticipant.value?.videoEnabled?.value = false + speakingParticipantVideoEnabled.value = false allParticipantsLeftEvent.value = Event(true) } 2 -> { @@ -192,6 +194,8 @@ class ConferenceViewModel : ViewModel() { } else -> {} } + } else { + speakingParticipantVideoEnabled.value = speakingParticipant.value?.isInConference?.value == true && speakingParticipant.value?.isSendingVideo?.value == true } } @@ -212,6 +216,7 @@ class ConferenceViewModel : ViewModel() { device.isActiveSpeaker.value = true speakingParticipant.value = device!! speakingParticipantFound.value = true + speakingParticipantVideoEnabled.value = speakingParticipant.value?.isInConference?.value == true && speakingParticipant.value?.isSendingVideo?.value == true } else if (device == null) { Log.w( "[Conference] Participant device [${participantDevice.address.asStringUriOnly()}] is the active speaker but couldn't find it in devices list" @@ -219,6 +224,20 @@ class ConferenceViewModel : ViewModel() { } } + override fun onParticipantDeviceMediaAvailabilityChanged( + conference: Conference, + device: ParticipantDevice + ) { + speakingParticipantVideoEnabled.value = speakingParticipant.value?.isInConference?.value == true && speakingParticipant.value?.isSendingVideo?.value == true + } + + override fun onParticipantDeviceMediaCapabilityChanged( + conference: Conference, + device: ParticipantDevice + ) { + speakingParticipantVideoEnabled.value = speakingParticipant.value?.isInConference?.value == true && speakingParticipant.value?.isSendingVideo?.value == true + } + override fun onStateChanged(conference: Conference, state: Conference.State) { Log.i("[Conference] State changed: $state") isVideoConference.value = conference.currentParams.isVideoEnabled && !corePreferences.disableVideo @@ -537,6 +556,7 @@ class ConferenceViewModel : ViewModel() { val activelySpeakingParticipantDevice = conference.activeSpeakerParticipantDevice var foundActivelySpeakingParticipantDevice = false speakingParticipantFound.value = false + speakingParticipantVideoEnabled.value = false val conferenceInfo = conference.core.findConferenceInformationFromUri( conference.conferenceAddress @@ -587,6 +607,7 @@ class ConferenceViewModel : ViewModel() { deviceData.isActiveSpeaker.value = true foundActivelySpeakingParticipantDevice = true speakingParticipantFound.value = true + speakingParticipantVideoEnabled.value = speakingParticipant.value?.isInConference?.value == true && speakingParticipant.value?.isSendingVideo?.value == true } } } @@ -599,6 +620,7 @@ class ConferenceViewModel : ViewModel() { speakingParticipant.value = deviceData deviceData.isActiveSpeaker.value = true speakingParticipantFound.value = true + speakingParticipantVideoEnabled.value = speakingParticipant.value?.isInConference?.value == true && speakingParticipant.value?.isSendingVideo?.value == true } for (device in conference.me.devices) { @@ -666,10 +688,11 @@ class ConferenceViewModel : ViewModel() { val sortedDevices = sortDevicesDataList(devices) - if (speakingParticipant.value == null) { + if (speakingParticipant.value == null || speakingParticipantFound.value == false) { speakingParticipant.value = deviceData deviceData.isActiveSpeaker.value = true - speakingParticipantFound.value = false + speakingParticipantFound.value = true + speakingParticipantVideoEnabled.value = speakingParticipant.value?.isInConference?.value == true && speakingParticipant.value?.isSendingVideo?.value == true } conferenceParticipantDevices.value = sortedDevices @@ -710,7 +733,8 @@ class ConferenceViewModel : ViewModel() { val deviceData = devices[1] speakingParticipant.value = deviceData deviceData.isActiveSpeaker.value = true - speakingParticipantFound.value = false + speakingParticipantFound.value = true + speakingParticipantVideoEnabled.value = speakingParticipant.value?.isInConference?.value == true && speakingParticipant.value?.isSendingVideo?.value == true } conferenceParticipantDevices.value = devices diff --git a/app/src/main/java/org/linphone/core/CoreService.kt b/app/src/main/java/org/linphone/core/CoreService.kt index fbafc16d8..f2f715efb 100644 --- a/app/src/main/java/org/linphone/core/CoreService.kt +++ b/app/src/main/java/org/linphone/core/CoreService.kt @@ -82,7 +82,7 @@ class CoreService : CoreService() { // Done elsewhere } - override fun showForegroundServiceNotification() { + override fun showForegroundServiceNotification(isVideoCall: Boolean) { Log.i("[Service] Starting service as foreground") coreContext.notificationsManager.startCallForeground(this) } diff --git a/app/src/main/res/layout-land/voip_conference_active_speaker.xml b/app/src/main/res/layout-land/voip_conference_active_speaker.xml index 8a5301c07..df24c7f74 100644 --- a/app/src/main/res/layout-land/voip_conference_active_speaker.xml +++ b/app/src/main/res/layout-land/voip_conference_active_speaker.xml @@ -221,7 +221,7 @@ android:id="@+id/conference_active_speaker_remote_video" android:layout_width="0dp" android:layout_height="0dp" - android:visibility="@{!conferenceViewModel.isConferenceLocallyPaused && conferenceViewModel.speakingParticipant.videoEnabled && conferenceViewModel.speakingParticipant.isInConference ? View.VISIBLE : View.GONE}" + android:visibility="@{!conferenceViewModel.isConferenceLocallyPaused && conferenceViewModel.speakingParticipantVideoEnabled ? View.VISIBLE : View.GONE}" app:layout_constraintBottom_toBottomOf="@id/active_speaker_background" app:layout_constraintEnd_toEndOf="@id/active_speaker_background" app:layout_constraintStart_toStartOf="@id/active_speaker_background" diff --git a/app/src/main/res/layout/voip_conference_active_speaker.xml b/app/src/main/res/layout/voip_conference_active_speaker.xml index 4047035cb..2d2fd7234 100644 --- a/app/src/main/res/layout/voip_conference_active_speaker.xml +++ b/app/src/main/res/layout/voip_conference_active_speaker.xml @@ -180,7 +180,7 @@ android:id="@+id/conference_active_speaker_remote_video" android:layout_width="match_parent" android:layout_height="0dp" - android:visibility="@{!conferenceViewModel.isConferenceLocallyPaused && conferenceViewModel.speakingParticipant.videoEnabled && conferenceViewModel.speakingParticipant.isInConference ? View.VISIBLE : View.GONE}" + android:visibility="@{!conferenceViewModel.isConferenceLocallyPaused && conferenceViewModel.speakingParticipantVideoEnabled ? View.VISIBLE : View.GONE}" app:layout_constraintBottom_toBottomOf="@id/active_speaker_background" app:layout_constraintTop_toTopOf="@id/active_speaker_background" />