Bläddra i källkod

fix(VideoLayout): store userID in container

The container needs to store user's ID in order for the 'isOnLargeVideo'
logic to work correctly when user has no stream (previously it was
obtained from stream which can be null/undefined).
master
paweldomas 8 år sedan
förälder
incheckning
751f27644f

+ 2
- 1
modules/UI/videolayout/LargeContainer.js Visa fil

@@ -42,10 +42,11 @@ export default class LargeContainer {
42 42
 
43 43
     /**
44 44
      * Update video stream.
45
+     * @param {string} userID
45 46
      * @param {JitsiTrack?} stream new stream
46 47
      * @param {string} videoType video type
47 48
      */
48
-    setStream (stream, videoType) { // eslint-disable-line no-unused-vars
49
+    setStream (userID, stream, videoType) {// eslint-disable-line no-unused-vars
49 50
     }
50 51
 
51 52
     /**

+ 1
- 1
modules/UI/videolayout/LargeVideoManager.js Visa fil

@@ -178,7 +178,7 @@ export default class LargeVideoManager {
178 178
             logger.info("hover in %s", id);
179 179
             this.state = videoType;
180 180
             const container = this.getContainer(this.state);
181
-            container.setStream(stream, videoType);
181
+            container.setStream(id, stream, videoType);
182 182
 
183 183
             // change the avatar url on large
184 184
             this.updateAvatar(Avatar.getAvatarUrl(id));

+ 5
- 2
modules/UI/videolayout/LocalVideo.js Visa fil

@@ -112,8 +112,11 @@ LocalVideo.prototype.changeVideo = function (stream) {
112 112
         localVideoContainer.removeChild(localVideo);
113 113
         // when removing only the video element and we are on stage
114 114
         // update the stage
115
-        if(this.isCurrentlyOnLargeVideo())
116
-            this.VideoLayout.updateLargeVideo(this.id);
115
+        if (this.isCurrentlyOnLargeVideo()) {
116
+            this.VideoLayout.updateLargeVideo(
117
+                this.id,
118
+                true /* force - stream removed for the same user ID */);
119
+        }
117 120
         stream.off(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);
118 121
     };
119 122
     stream.on(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);

+ 6
- 3
modules/UI/videolayout/RemoteVideo.js Visa fil

@@ -431,11 +431,14 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream) {
431 431
 
432 432
     // when removing only the video element and we are on stage
433 433
     // update the stage
434
-    if (isVideo && this.isCurrentlyOnLargeVideo())
435
-        this.VideoLayout.updateLargeVideo(this.id);
436
-    else
434
+    if (isVideo && this.isCurrentlyOnLargeVideo()) {
435
+        this.VideoLayout.updateLargeVideo(
436
+            this.id,
437
+            true /* force - same user ID, but removed video stream */);
438
+    } else {
437 439
         // Missing video stream will affect display mode
438 440
         this.updateView();
441
+    }
439 442
 };
440 443
 
441 444
 /**

+ 6
- 19
modules/UI/videolayout/VideoContainer.js Visa fil

@@ -1,4 +1,4 @@
1
-/* global $, APP, interfaceConfig */
1
+/* global $, interfaceConfig */
2 2
 /* jshint -W101 */
3 3
 
4 4
 import Filmstrip from './Filmstrip';
@@ -11,22 +11,6 @@ export const VIDEO_CONTAINER_TYPE = "camera";
11 11
 
12 12
 const FADE_DURATION_MS = 300;
13 13
 
14
-/**
15
- * Get stream id.
16
- * @param {JitsiTrack?} stream
17
- */
18
-function getStreamOwnerId(stream) {
19
-    if (!stream) {
20
-        return;
21
-    }
22
-    // local stream doesn't have method "getParticipantId"
23
-    if (stream.isLocal()) {
24
-        return APP.conference.getMyUserId();
25
-    } else {
26
-        return stream.getParticipantId();
27
-    }
28
-}
29
-
30 14
 /**
31 15
  * Returns an array of the video dimensions, so that it keeps it's aspect
32 16
  * ratio and fits available area with it's larger dimension. This method
@@ -171,7 +155,7 @@ export class VideoContainer extends LargeContainer {
171 155
     }
172 156
 
173 157
     get id () {
174
-        return getStreamOwnerId(this.stream);
158
+        return this.userId;
175 159
     }
176 160
 
177 161
     /**
@@ -184,6 +168,7 @@ export class VideoContainer extends LargeContainer {
184 168
     constructor (resizeContainer, emitter) {
185 169
         super();
186 170
         this.stream = null;
171
+        this.userId = null;
187 172
         this.videoType = null;
188 173
         this.localFlipX = true;
189 174
         this.emitter = emitter;
@@ -410,10 +395,12 @@ export class VideoContainer extends LargeContainer {
410 395
 
411 396
     /**
412 397
      * Update video stream.
398
+     * @param {string} userID
413 399
      * @param {JitsiTrack?} stream new stream
414 400
      * @param {string} videoType video type
415 401
      */
416
-    setStream (stream, videoType) {
402
+    setStream (userID, stream, videoType) {
403
+        this.userId = userID;
417 404
         if (this.stream === stream) {
418 405
             // Handles the use case for the remote participants when the
419 406
             // videoType is received with delay after turning on/off the

+ 1
- 1
modules/UI/videolayout/VideoLayout.js Visa fil

@@ -761,7 +761,7 @@ var VideoLayout = {
761 761
         if (remoteVideo) {
762 762
             remoteVideo.updateView();
763 763
             if (remoteVideo.isCurrentlyOnLargeVideo()) {
764
-                this.updateLargeVideo(id);
764
+                this.updateLargeVideo(id, true);
765 765
             }
766 766
         }
767 767
     },

Laddar…
Avbryt
Spara