Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

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

Jaya Allamsettyc12c55413833
diff --git a/react/features/video-layout/subscriber.js b/react/features/video-layout/subscriber.js
index bf8584f707..abda9072eb 100644
--- a/react/features/video-layout/subscriber.js
+++ b/react/features/video-layout/subscriber.js
@@ -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));
}
}