Browse Source

Merge pull request #519 from isymchych/lastn

Use overriden config.channelLastN property in VideoLayout
master
yanas 9 years ago
parent
commit
c201de86cc
1 changed files with 11 additions and 8 deletions
  1. 11
    8
      modules/UI/videolayout/VideoLayout.js

+ 11
- 8
modules/UI/videolayout/VideoLayout.js View File

20
 var localVideoThumbnail = null;
20
 var localVideoThumbnail = null;
21
 
21
 
22
 var currentDominantSpeaker = null;
22
 var currentDominantSpeaker = null;
23
-var lastNCount = config.channelLastN;
24
 var localLastNCount = config.channelLastN;
23
 var localLastNCount = config.channelLastN;
25
 var localLastNSet = [];
24
 var localLastNSet = [];
26
 var lastNEndpointsCache = [];
25
 var lastNEndpointsCache = [];
96
         localVideoThumbnail = new LocalVideo(VideoLayout, emitter);
95
         localVideoThumbnail = new LocalVideo(VideoLayout, emitter);
97
 
96
 
98
         emitter.addListener(UIEvents.CONTACT_CLICKED, onContactClicked);
97
         emitter.addListener(UIEvents.CONTACT_CLICKED, onContactClicked);
98
+        this.lastNCount = config.channelLastN;
99
     },
99
     },
100
 
100
 
101
     initLargeVideo (isSideBarVisible) {
101
     initLargeVideo (isSideBarVisible) {
114
     },
114
     },
115
 
115
 
116
     isInLastN (resource) {
116
     isInLastN (resource) {
117
-        return lastNCount < 0 || // lastN is disabled
117
+        return this.lastNCount < 0 || // lastN is disabled
118
              // lastNEndpoints cache not built yet
118
              // lastNEndpoints cache not built yet
119
-            (lastNCount > 0 && !lastNEndpointsCache.length) ||
119
+            (this.lastNCount > 0 && !lastNEndpointsCache.length) ||
120
             (lastNEndpointsCache &&
120
             (lastNEndpointsCache &&
121
                 lastNEndpointsCache.indexOf(resource) !== -1);
121
                 lastNEndpointsCache.indexOf(resource) !== -1);
122
     },
122
     },
268
 
268
 
269
     onRemoteStreamRemoved (stream) {
269
     onRemoteStreamRemoved (stream) {
270
         let id = stream.getParticipantId();
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
      * endpoints
527
      * endpoints
525
      */
528
      */
526
     onLastNEndpointsChanged (lastNEndpoints, endpointsEnteringLastN) {
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
         lastNEndpointsCache = lastNEndpoints;
533
         lastNEndpointsCache = lastNEndpoints;
531
 
534
 
540
         // enters E's local LastN ejecting C.
543
         // enters E's local LastN ejecting C.
541
 
544
 
542
         // Increase the local LastN set size, if necessary.
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
         // Update the local LastN set preserving the order in which the
550
         // Update the local LastN set preserving the order in which the

Loading…
Cancel
Save