Browse Source

fix(video-layout): Fix video-layout when a SS participant leaves.

 Unpin the screenshare when the screensharing participant leaves. Switch to tile view if no other participant was pinned before screenshare was auto-pinned, pin the previously pinned participant otherwise.
j8
Jaya Allamsetty 4 years ago
parent
commit
035d026e90
1 changed files with 11 additions and 3 deletions
  1. 11
    3
      react/features/video-layout/subscriber.js

+ 11
- 3
react/features/video-layout/subscriber.js View File

@@ -12,6 +12,8 @@ import { setRemoteParticipantsWithScreenShare } from './actions';
12 12
 declare var APP: Object;
13 13
 declare var interfaceConfig: Object;
14 14
 
15
+let latestScreenshareParticipantId;
16
+
15 17
 /**
16 18
  * StateListenerRegistry provides a reliable way of detecting changes to
17 19
  * preferred layout state and dispatching additional actions.
@@ -99,16 +101,22 @@ function _updateAutoPinnedParticipant({ dispatch, getState }) {
99 101
     const remoteScreenShares = state['features/video-layout'].remoteScreenShares;
100 102
     const pinned = getPinnedParticipant(getState);
101 103
 
102
-    // Unpin the screenshare when the screensharing participant has left.
104
+    // Unpin the screenshare when the screensharing participant leaves. Switch to tile view if no other
105
+    // participant was pinned before screenshare was auto-pinned, pin the previously pinned participant otherwise.
103 106
     if (!remoteScreenShares?.length) {
104
-        const participantId = pinned ? pinned.id : null;
107
+        let participantId = null;
108
+
109
+        if (pinned && pinned.id !== latestScreenshareParticipantId) {
110
+            participantId = pinned.id;
111
+        }
105 112
 
113
+        latestScreenshareParticipantId = null;
106 114
         dispatch(pinParticipant(participantId));
107 115
 
108 116
         return;
109 117
     }
110 118
 
111
-    const latestScreenshareParticipantId = remoteScreenShares[remoteScreenShares.length - 1];
119
+    latestScreenshareParticipantId = remoteScreenShares[remoteScreenShares.length - 1];
112 120
 
113 121
     if (latestScreenshareParticipantId) {
114 122
         dispatch(pinParticipant(latestScreenshareParticipantId));

Loading…
Cancel
Save