瀏覽代碼

fix(participants-pane) Place Dominant Speaker first in participants list

Move function participants list ordering function in participant-pane, since that's the only feature that uses it.
master
robertpin 4 年之前
父節點
當前提交
483bc45d59
沒有連結到貢獻者的電子郵件帳戶。

+ 0
- 41
react/features/base/participants/functions.js 查看文件

455
     return undefined;
455
     return undefined;
456
 }
456
 }
457
 
457
 
458
-/**
459
- * Selector for retrieving ids of participants in the order that they are displayed in the filmstrip (with the
460
- * exception of participants with raised hand). The participants are reordered as follows.
461
- * 1. Local participant.
462
- * 2. Participants with raised hand.
463
- * 3. Participants with screenshare sorted alphabetically by their display name.
464
- * 4. Shared video participants.
465
- * 5. Recent speakers sorted alphabetically by their display name.
466
- * 6. Rest of the participants sorted alphabetically by their display name.
467
- *
468
- * @param {(Function|Object)} stateful - The (whole) redux state, or redux's
469
- * {@code getState} function to be used to retrieve the state features/base/participants.
470
- * @returns {Array<string>}
471
- */
472
-export function getSortedParticipantIds(stateful: Object | Function): Array<string> {
473
-    const { id } = getLocalParticipant(stateful);
474
-    const remoteParticipants = getRemoteParticipantsSorted(stateful);
475
-    const reorderedParticipants = new Set(remoteParticipants);
476
-    const raisedHandParticipants = getRaiseHandsQueue(stateful);
477
-    const remoteRaisedHandParticipants = new Set(raisedHandParticipants || []);
478
-
479
-    for (const participant of remoteRaisedHandParticipants.keys()) {
480
-        // Avoid duplicates.
481
-        if (reorderedParticipants.has(participant)) {
482
-            reorderedParticipants.delete(participant);
483
-        } else {
484
-            remoteRaisedHandParticipants.delete(participant);
485
-        }
486
-    }
487
-
488
-    // Remove self.
489
-    remoteRaisedHandParticipants.has(id) && remoteRaisedHandParticipants.delete(id);
490
-
491
-    // Move self and participants with raised hand to the top of the list.
492
-    return [
493
-        id,
494
-        ...Array.from(remoteRaisedHandParticipants.keys()),
495
-        ...Array.from(reorderedParticipants.keys())
496
-    ];
497
-}
498
-
499
 /**
458
 /**
500
  * Get the participants queue with raised hands.
459
  * Get the participants queue with raised hands.
501
  *
460
  *

+ 2
- 3
react/features/participants-pane/components/web/MeetingParticipants.js 查看文件

8
 import { isToolbarButtonEnabled } from '../../../base/config/functions.web';
8
 import { isToolbarButtonEnabled } from '../../../base/config/functions.web';
9
 import { MEDIA_TYPE } from '../../../base/media';
9
 import { MEDIA_TYPE } from '../../../base/media';
10
 import {
10
 import {
11
-    getParticipantCountWithFake,
12
-    getSortedParticipantIds
11
+    getParticipantCountWithFake
13
 } from '../../../base/participants';
12
 } from '../../../base/participants';
14
 import { connect } from '../../../base/redux';
13
 import { connect } from '../../../base/redux';
15
 import { showOverflowDrawer } from '../../../toolbox/functions';
14
 import { showOverflowDrawer } from '../../../toolbox/functions';
16
 import { muteRemote } from '../../../video-menu/actions.any';
15
 import { muteRemote } from '../../../video-menu/actions.any';
17
-import { findStyledAncestor, shouldRenderInviteButton } from '../../functions';
16
+import { findStyledAncestor, getSortedParticipantIds, shouldRenderInviteButton } from '../../functions';
18
 import { useParticipantDrawer } from '../../hooks';
17
 import { useParticipantDrawer } from '../../hooks';
19
 
18
 
20
 import { InviteButton } from './InviteButton';
19
 import { InviteButton } from './InviteButton';

+ 58
- 1
react/features/participants-pane/functions.js 查看文件

11
 import {
11
 import {
12
     getDominantSpeakerParticipant,
12
     getDominantSpeakerParticipant,
13
     isLocalParticipantModerator,
13
     isLocalParticipantModerator,
14
-    isParticipantModerator
14
+    isParticipantModerator,
15
+    getLocalParticipant,
16
+    getRemoteParticipantsSorted,
17
+    getRaiseHandsQueue
15
 } from '../base/participants/functions';
18
 } from '../base/participants/functions';
16
 import { toState } from '../base/redux';
19
 import { toState } from '../base/redux';
17
 
20
 
188
 
191
 
189
     return flagEnabled && !disableInviteFunctions;
192
     return flagEnabled && !disableInviteFunctions;
190
 };
193
 };
194
+
195
+/**
196
+ * Selector for retrieving ids of participants in the order that they are displayed in the filmstrip (with the
197
+ * exception of participants with raised hand). The participants are reordered as follows.
198
+ * 1. Dominant speaker.
199
+ * 2. Local participant.
200
+ * 3. Participants with raised hand.
201
+ * 4. Participants with screenshare sorted alphabetically by their display name.
202
+ * 5. Shared video participants.
203
+ * 6. Recent speakers sorted alphabetically by their display name.
204
+ * 7. Rest of the participants sorted alphabetically by their display name.
205
+ *
206
+ * @param {(Function|Object)} stateful - The (whole) redux state, or redux's
207
+ * {@code getState} function to be used to retrieve the state features/base/participants.
208
+ * @returns {Array<string>}
209
+ */
210
+export function getSortedParticipantIds(stateful: Object | Function): Array<string> {
211
+    const { id } = getLocalParticipant(stateful);
212
+    const remoteParticipants = getRemoteParticipantsSorted(stateful);
213
+    const reorderedParticipants = new Set(remoteParticipants);
214
+    const raisedHandParticipants = getRaiseHandsQueue(stateful);
215
+    const remoteRaisedHandParticipants = new Set(raisedHandParticipants || []);
216
+    const dominantSpeaker = getDominantSpeakerParticipant(stateful);
217
+
218
+    for (const participant of remoteRaisedHandParticipants.keys()) {
219
+        // Avoid duplicates.
220
+        if (reorderedParticipants.has(participant)) {
221
+            reorderedParticipants.delete(participant);
222
+        } else {
223
+            remoteRaisedHandParticipants.delete(participant);
224
+        }
225
+    }
226
+
227
+    // Remove self.
228
+    remoteRaisedHandParticipants.delete(id);
229
+
230
+    const dominant = [];
231
+
232
+    // Remove dominant speaker.
233
+    if (dominantSpeaker && dominantSpeaker.id !== id) {
234
+        remoteRaisedHandParticipants.delete(dominantSpeaker.id);
235
+        reorderedParticipants.delete(dominantSpeaker.id);
236
+        dominant.push(dominantSpeaker.id);
237
+    }
238
+
239
+    // Move self and participants with raised hand to the top of the list.
240
+    return [
241
+        ...dominant,
242
+        id,
243
+        ...Array.from(remoteRaisedHandParticipants.keys()),
244
+        ...Array.from(reorderedParticipants.keys())
245
+    ];
246
+}
247
+

Loading…
取消
儲存