Pārlūkot izejas kodu

Merge pull request #519 from isymchych/lastn

Use overriden config.channelLastN property in VideoLayout
j8
yanas 9 gadus atpakaļ
vecāks
revīzija
c201de86cc
1 mainītis faili ar 11 papildinājumiem un 8 dzēšanām
  1. 11
    8
      modules/UI/videolayout/VideoLayout.js

+ 11
- 8
modules/UI/videolayout/VideoLayout.js Parādīt failu

@@ -20,7 +20,6 @@ var remoteVideoTypes = {};
20 20
 var localVideoThumbnail = null;
21 21
 
22 22
 var currentDominantSpeaker = null;
23
-var lastNCount = config.channelLastN;
24 23
 var localLastNCount = config.channelLastN;
25 24
 var localLastNSet = [];
26 25
 var lastNEndpointsCache = [];
@@ -96,6 +95,7 @@ var VideoLayout = {
96 95
         localVideoThumbnail = new LocalVideo(VideoLayout, emitter);
97 96
 
98 97
         emitter.addListener(UIEvents.CONTACT_CLICKED, onContactClicked);
98
+        this.lastNCount = config.channelLastN;
99 99
     },
100 100
 
101 101
     initLargeVideo (isSideBarVisible) {
@@ -114,9 +114,9 @@ var VideoLayout = {
114 114
     },
115 115
 
116 116
     isInLastN (resource) {
117
-        return lastNCount < 0 || // lastN is disabled
117
+        return this.lastNCount < 0 || // lastN is disabled
118 118
              // lastNEndpoints cache not built yet
119
-            (lastNCount > 0 && !lastNEndpointsCache.length) ||
119
+            (this.lastNCount > 0 && !lastNEndpointsCache.length) ||
120 120
             (lastNEndpointsCache &&
121 121
                 lastNEndpointsCache.indexOf(resource) !== -1);
122 122
     },
@@ -268,7 +268,10 @@ var VideoLayout = {
268 268
 
269 269
     onRemoteStreamRemoved (stream) {
270 270
         let id = stream.getParticipantId();
271
-        remoteVideos[id].removeRemoteStreamElement(stream);
271
+        let remoteVideo = remoteVideos[id];
272
+        if (remoteVideo) { // remote stream may be removed after participant left the conference
273
+            remoteVideo.removeRemoteStreamElement(stream);
274
+        }
272 275
     },
273 276
 
274 277
     /**
@@ -524,8 +527,8 @@ var VideoLayout = {
524 527
      * endpoints
525 528
      */
526 529
     onLastNEndpointsChanged (lastNEndpoints, endpointsEnteringLastN) {
527
-        if (lastNCount !== lastNEndpoints.length)
528
-            lastNCount = lastNEndpoints.length;
530
+        if (this.lastNCount !== lastNEndpoints.length)
531
+            this.lastNCount = lastNEndpoints.length;
529 532
 
530 533
         lastNEndpointsCache = lastNEndpoints;
531 534
 
@@ -540,8 +543,8 @@ var VideoLayout = {
540 543
         // enters E's local LastN ejecting C.
541 544
 
542 545
         // Increase the local LastN set size, if necessary.
543
-        if (lastNCount > localLastNCount) {
544
-            localLastNCount = lastNCount;
546
+        if (this.lastNCount > localLastNCount) {
547
+            localLastNCount = this.lastNCount;
545 548
         }
546 549
 
547 550
         // Update the local LastN set preserving the order in which the

Notiek ielāde…
Atcelt
Saglabāt