fix(video-layout): Unpin SS when the screensharing participant leaves.

This commit is contained in:
Jaya Allamsetty 2021-04-15 16:12:31 -04:00 committed by Jaya Allamsetty
parent 289ba6f764
commit c12c554138
1 changed files with 8 additions and 7 deletions

View File

@ -97,19 +97,20 @@ function _getAutoPinSetting() {
function _updateAutoPinnedParticipant({ dispatch, getState }) {
const state = getState();
const remoteScreenShares = state['features/video-layout'].remoteScreenShares;
const pinned = getPinnedParticipant(getState);
// Unpin the screenshare when the screensharing participant has left.
if (!remoteScreenShares?.length) {
const participantId = pinned ? pinned.id : null;
dispatch(pinParticipant(participantId));
if (!remoteScreenShares) {
return;
}
const latestScreenshareParticipantId
= remoteScreenShares[remoteScreenShares.length - 1];
const pinned = getPinnedParticipant(getState);
const latestScreenshareParticipantId = remoteScreenShares[remoteScreenShares.length - 1];
if (latestScreenshareParticipantId) {
dispatch(pinParticipant(latestScreenshareParticipantId));
} else if (pinned) {
dispatch(pinParticipant(null));
}
}