Deprioritize speaker video when there is a screenshare presenting

This commit is contained in:
adel-signal 2026-05-06 10:36:44 -07:00 committed by GitHub
parent 00f622dfc3
commit 4dd96105cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -63,6 +63,7 @@ class GroupCallRemoteVideoManager {
guard let groupCall = self.currentRingRtcCall else { return }
var activeSpeakerHeight: UInt16 = 0
var isSomeonePresenting = false
let videoRequests: [VideoRequest] = groupCall.remoteDeviceStates.map { demuxId, _ in
guard
@ -72,6 +73,8 @@ class GroupCallRemoteVideoManager {
return VideoRequest(demuxId: demuxId, width: 0, height: 0, framerate: nil)
}
isSomeonePresenting = isSomeonePresenting || renderingVideoViews.contains(where: \.value.isScreenShare)
if let activeSpeakerVideoView = renderingVideoViews[.speaker] {
activeSpeakerHeight = max(activeSpeakerHeight, UInt16(activeSpeakerVideoView.currentSize.height))
}
@ -88,6 +91,9 @@ class GroupCallRemoteVideoManager {
)
}
// currently we do not support presenting + speaker videos
// so when someone is presenting, do not prioritize active speaker video over presenter video
activeSpeakerHeight = isSomeonePresenting ? 0 : activeSpeakerHeight
groupCall.updateVideoRequests(resolutions: videoRequests, activeSpeakerHeight: activeSpeakerHeight)
}
})