Hide active speaker miniature

This commit is contained in:
Christophe Deschamps 2023-01-10 11:51:54 +01:00
parent fd627b4c4a
commit 5fe2af9d50
2 changed files with 24 additions and 14 deletions

View file

@ -122,16 +122,16 @@ class ConferenceViewModel {
},
onActiveSpeakerParticipantDevice: { (conference: Conference, participantDevice: ParticipantDevice) in
Log.i("[Conference] Participant [\(participantDevice.address?.asStringUriOnly())] is currently being displayed as active speaker")
if let device = self.conferenceParticipantDevices.value?.filter ({
$0.participantDevice.address!.weakEqual(address2: participantDevice.address!)
}).first {
if (device.participantDevice.address?.asString() != self.speakingParticipant.value?.participantDevice.address?.asString()) {
Log.i("[Conference] Found actively speaking participant device")
self.speakingParticipant.value = device
}
} else {
Log.w("[Conference] Participant device [\((participantDevice.address?.asStringUriOnly()).orNil)] is the active speaker but couldn't find it in devices list")
if let device = self.conferenceParticipantDevices.value?.filter ({
$0.participantDevice.address!.weakEqual(address2: participantDevice.address!)
}).first {
if (device.participantDevice.address?.asString() != self.speakingParticipant.value?.participantDevice.address?.asString()) {
Log.i("[Conference] Found actively speaking participant device")
self.speakingParticipant.value = device
}
} else {
Log.w("[Conference] Participant device [\((participantDevice.address?.asStringUriOnly()).orNil)] is the active speaker but couldn't find it in devices list")
}
}
)
@ -168,6 +168,12 @@ class ConferenceViewModel {
}
func updateActiveSpeakerConferenceParticipantDevices () {
activeSpeakerConferenceParticipantDevices.value = self.conferenceParticipantDevices.value!.filter { data in // Filter me and speaking device
data.isMe != true && speakingParticipant.value?.participantDevice.address?.weakEqual(address2: data.participantDevice.address!) != true
}
}
func notifyAdminStatusChanged(participantData:ConferenceParticipantData) {
if let participantName = participantData.participant.address?.addressBookEnhancedDisplayName() {
let message = (participantData.participant.isAdmin ? VoipTexts.conference_admin_set : VoipTexts.conference_admin_unset).replacingOccurrences(of: "%s", with: participantName)

View file

@ -72,12 +72,16 @@ class VoipConferenceActiveSpeakerView: UIView, UICollectionViewDataSource, UICol
}
duration.conference = model.conference.value
self.remotelyRecording.isRemotelyRecorded = model.isRemotelyRecorded
model.conferenceParticipantDevices.readCurrentAndObserve { value in
model.activeSpeakerConferenceParticipantDevices.value = Array((value!.dropFirst().filter { !$0.isMe } ))
model.conferenceParticipantDevices.readCurrentAndObserve { _ in
model.updateActiveSpeakerConferenceParticipantDevices()
}
model.speakingParticipant.readCurrentAndObserve { _ in
model.updateActiveSpeakerConferenceParticipantDevices()
}
model.activeSpeakerConferenceParticipantDevices.readCurrentAndObserve { (_) in
self.reloadData()
let otherSpeakersCount = model.activeSpeakerConferenceParticipantDevices.value!.count
let otherSpeakersCount = model.conferenceParticipantDevices.value!.count - 1
self.switchCamera.isHidden = true
if (otherSpeakersCount == 0) {
self.layoutRotatableElements()
@ -139,7 +143,7 @@ class VoipConferenceActiveSpeakerView: UIView, UICollectionViewDataSource, UICol
}
}
model.speakingParticipant.readCurrentAndObserve { speakingParticipant in
if (model.activeSpeakerConferenceParticipantDevices.value!.count > 1) {
if (model.conferenceParticipantDevices.value!.count - 1 > 1) {
speakingParticipant?.videoEnabled.readCurrentAndObserve { video in
self.fillActiveSpeakerSpace(data: speakingParticipant,video: video == true)
self.muted.isHidden = true
@ -395,7 +399,7 @@ class VoipConferenceActiveSpeakerView: UIView, UICollectionViewDataSource, UICol
meGrid.removeConstraints().done()
activeSpeakerView.removeConstraints().done()
activeSpeakerAvatar.removeConstraints().done()
let otherParticipantsCount = conferenceViewModel?.activeSpeakerConferenceParticipantDevices.value!.count
let otherParticipantsCount = (conferenceViewModel?.conferenceParticipantDevices.value!.count ?? 0) - 1
if ([.landscapeLeft, .landscapeRight].contains( UIDevice.current.orientation)) {
if (otherParticipantsCount == 0) {
activeSpeakerView.matchParentDimmensions().done()