浏览代码

squash: use oldScreenSharesOrder for checking.

master
Jaya Allamsetty 4 年前
父节点
当前提交
1c6677f523
共有 1 个文件被更改,包括 6 次插入8 次删除
  1. 6
    8
      react/features/video-layout/subscriber.js

+ 6
- 8
react/features/video-layout/subscriber.js 查看文件

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

正在加载...
取消
保存