Quellcode durchsuchen

Changes lastN event params to leaving and entering endpoint IDs.

Uses leavingIDs to more efficiently iterate over remote videos.
j8
damencho vor 8 Jahren
Ursprung
Commit
e29120a9c1
3 geänderte Dateien mit 30 neuen und 22 gelöschten Zeilen
  1. 3
    2
      conference.js
  2. 2
    2
      modules/UI/UI.js
  3. 25
    18
      modules/UI/videolayout/VideoLayout.js

+ 3
- 2
conference.js Datei anzeigen

@@ -1305,8 +1305,9 @@ export default {
1305 1305
         });
1306 1306
 
1307 1307
         room.on(
1308
-            ConferenceEvents.LAST_N_ENDPOINTS_CHANGED, (ids, enteringIds) => {
1309
-                APP.UI.handleLastNEndpoints(ids, enteringIds);
1308
+            ConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
1309
+            (leavingIds, enteringIds) => {
1310
+                APP.UI.handleLastNEndpoints(leavingIds, enteringIds);
1310 1311
         });
1311 1312
 
1312 1313
         room.on(

+ 2
- 2
modules/UI/UI.js Datei anzeigen

@@ -837,8 +837,8 @@ UI.markDominantSpeaker = function (id) {
837 837
     VideoLayout.onDominantSpeakerChanged(id);
838 838
 };
839 839
 
840
-UI.handleLastNEndpoints = function (ids, enteringIds) {
841
-    VideoLayout.onLastNEndpointsChanged(ids, enteringIds);
840
+UI.handleLastNEndpoints = function (leavingIds, enteringIds) {
841
+    VideoLayout.onLastNEndpointsChanged(leavingIds, enteringIds);
842 842
 };
843 843
 
844 844
 /**

+ 25
- 18
modules/UI/videolayout/VideoLayout.js Datei anzeigen

@@ -687,27 +687,34 @@ var VideoLayout = {
687 687
     /**
688 688
      * On last N change event.
689 689
      *
690
-     * @param lastNEndpoints the list of last N endpoints
690
+     * @param endpointsLeavingLastN the list currently leaving last N
691
+     * endpoints
691 692
      * @param endpointsEnteringLastN the list currently entering last N
692 693
      * endpoints
693 694
      */
694
-    onLastNEndpointsChanged (lastNEndpoints, endpointsEnteringLastN) {
695
-
696
-        Object.keys(remoteVideos).forEach(
697
-            id => {
698
-                if (lastNEndpoints.length > 0
699
-                    && lastNEndpoints.indexOf(id) < 0
700
-                    || endpointsEnteringLastN.length > 0
701
-                        && endpointsEnteringLastN.indexOf(id) > 0) {
702
-
703
-                    let remoteVideo = (id) ? remoteVideos[id] : null;
704
-                    if (remoteVideo) {
705
-                        remoteVideo.updateView();
706
-                        if (remoteVideo.isCurrentlyOnLargeVideo())
707
-                            this.updateLargeVideo(id);
708
-                    }
709
-                }
710
-            });
695
+    onLastNEndpointsChanged (endpointsLeavingLastN, endpointsEnteringLastN) {
696
+        if (endpointsLeavingLastN) {
697
+            endpointsLeavingLastN.forEach(this._updateRemoteVideo, this);
698
+        }
699
+
700
+        if (endpointsEnteringLastN) {
701
+            endpointsEnteringLastN.forEach(this._updateRemoteVideo, this);
702
+        }
703
+    },
704
+
705
+    /**
706
+     * Updates remote video by id if it exists.
707
+     * @param {string} id of the remote video
708
+     * @private
709
+     */
710
+    _updateRemoteVideo(id) {
711
+        const remoteVideo = remoteVideos[id];
712
+        if (remoteVideo) {
713
+            remoteVideo.updateView();
714
+            if (remoteVideo.isCurrentlyOnLargeVideo()) {
715
+                this.updateLargeVideo(id);
716
+            }
717
+        }
711 718
     },
712 719
 
713 720
     /**

Laden…
Abbrechen
Speichern