Bläddra i källkod

squash: use oldScreenSharesOrder for checking.

j8
Jaya Allamsetty 4 år sedan
förälder
incheckning
1c6677f523
1 ändrade filer med 6 tillägg och 8 borttagningar
  1. 6
    8
      react/features/video-layout/subscriber.js

+ 6
- 8
react/features/video-layout/subscriber.js Visa fil

@@ -12,8 +12,6 @@ import { setRemoteParticipantsWithScreenShare } from './actions';
12 12
 declare var APP: Object;
13 13
 declare var interfaceConfig: Object;
14 14
 
15
-let latestScreenshareParticipantId;
16
-
17 15
 /**
18 16
  * StateListenerRegistry provides a reliable way of detecting changes to
19 17
  * preferred layout state and dispatching additional actions.
@@ -70,7 +68,7 @@ StateListenerRegistry.register(
70 68
             store.dispatch(
71 69
                 setRemoteParticipantsWithScreenShare(newScreenSharesOrder));
72 70
 
73
-            _updateAutoPinnedParticipant(store);
71
+            _updateAutoPinnedParticipant(oldScreenSharesOrder, store);
74 72
         }
75 73
     }, 100));
76 74
 
@@ -93,10 +91,12 @@ function _getAutoPinSetting() {
93 91
  * Private helper to automatically pin the latest screen share stream or unpin
94 92
  * if there are no more screen share streams.
95 93
  *
94
+ * @param {Array<string>} screenShares - Array containing the list of all the screensharing endpoints
95
+ * before the update was triggered (including the ones that have been removed from redux because of the update).
96 96
  * @param {Store} store - The redux store.
97 97
  * @returns {void}
98 98
  */
99
-function _updateAutoPinnedParticipant({ dispatch, getState }) {
99
+function _updateAutoPinnedParticipant(screenShares, { dispatch, getState }) {
100 100
     const state = getState();
101 101
     const remoteScreenShares = state['features/video-layout'].remoteScreenShares;
102 102
     const pinned = getPinnedParticipant(getState);
@@ -106,17 +106,15 @@ function _updateAutoPinnedParticipant({ dispatch, getState }) {
106 106
     if (!remoteScreenShares?.length) {
107 107
         let participantId = null;
108 108
 
109
-        if (pinned && pinned.id !== latestScreenshareParticipantId) {
109
+        if (pinned && !screenShares.find(share => share === pinned.id)) {
110 110
             participantId = pinned.id;
111 111
         }
112
-
113
-        latestScreenshareParticipantId = null;
114 112
         dispatch(pinParticipant(participantId));
115 113
 
116 114
         return;
117 115
     }
118 116
 
119
-    latestScreenshareParticipantId = remoteScreenShares[remoteScreenShares.length - 1];
117
+    const latestScreenshareParticipantId = remoteScreenShares[remoteScreenShares.length - 1];
120 118
 
121 119
     if (latestScreenshareParticipantId) {
122 120
         dispatch(pinParticipant(latestScreenshareParticipantId));

Laddar…
Avbryt
Spara