浏览代码

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 年前
父节点
当前提交
751f27644f

+ 2
- 1
modules/UI/videolayout/LargeContainer.js 查看文件

42
 
42
 
43
     /**
43
     /**
44
      * Update video stream.
44
      * Update video stream.
45
+     * @param {string} userID
45
      * @param {JitsiTrack?} stream new stream
46
      * @param {JitsiTrack?} stream new stream
46
      * @param {string} videoType video type
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 查看文件

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

+ 5
- 2
modules/UI/videolayout/LocalVideo.js 查看文件

112
         localVideoContainer.removeChild(localVideo);
112
         localVideoContainer.removeChild(localVideo);
113
         // when removing only the video element and we are on stage
113
         // when removing only the video element and we are on stage
114
         // update the stage
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
         stream.off(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);
120
         stream.off(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);
118
     };
121
     };
119
     stream.on(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);
122
     stream.on(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler);

+ 6
- 3
modules/UI/videolayout/RemoteVideo.js 查看文件

431
 
431
 
432
     // when removing only the video element and we are on stage
432
     // when removing only the video element and we are on stage
433
     // update the stage
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
         // Missing video stream will affect display mode
439
         // Missing video stream will affect display mode
438
         this.updateView();
440
         this.updateView();
441
+    }
439
 };
442
 };
440
 
443
 
441
 /**
444
 /**

+ 6
- 19
modules/UI/videolayout/VideoContainer.js 查看文件

1
-/* global $, APP, interfaceConfig */
1
+/* global $, interfaceConfig */
2
 /* jshint -W101 */
2
 /* jshint -W101 */
3
 
3
 
4
 import Filmstrip from './Filmstrip';
4
 import Filmstrip from './Filmstrip';
11
 
11
 
12
 const FADE_DURATION_MS = 300;
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
  * Returns an array of the video dimensions, so that it keeps it's aspect
15
  * Returns an array of the video dimensions, so that it keeps it's aspect
32
  * ratio and fits available area with it's larger dimension. This method
16
  * ratio and fits available area with it's larger dimension. This method
171
     }
155
     }
172
 
156
 
173
     get id () {
157
     get id () {
174
-        return getStreamOwnerId(this.stream);
158
+        return this.userId;
175
     }
159
     }
176
 
160
 
177
     /**
161
     /**
184
     constructor (resizeContainer, emitter) {
168
     constructor (resizeContainer, emitter) {
185
         super();
169
         super();
186
         this.stream = null;
170
         this.stream = null;
171
+        this.userId = null;
187
         this.videoType = null;
172
         this.videoType = null;
188
         this.localFlipX = true;
173
         this.localFlipX = true;
189
         this.emitter = emitter;
174
         this.emitter = emitter;
410
 
395
 
411
     /**
396
     /**
412
      * Update video stream.
397
      * Update video stream.
398
+     * @param {string} userID
413
      * @param {JitsiTrack?} stream new stream
399
      * @param {JitsiTrack?} stream new stream
414
      * @param {string} videoType video type
400
      * @param {string} videoType video type
415
      */
401
      */
416
-    setStream (stream, videoType) {
402
+    setStream (userID, stream, videoType) {
403
+        this.userId = userID;
417
         if (this.stream === stream) {
404
         if (this.stream === stream) {
418
             // Handles the use case for the remote participants when the
405
             // Handles the use case for the remote participants when the
419
             // videoType is received with delay after turning on/off the
406
             // videoType is received with delay after turning on/off the

+ 1
- 1
modules/UI/videolayout/VideoLayout.js 查看文件

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

正在加载...
取消
保存