Browse Source

fix(ss): resize for remote videos

j8
hristoterezov 8 years ago
parent
commit
0e92e48376

+ 2
- 0
modules/UI/videolayout/LargeVideoManager.js View File

@@ -23,6 +23,8 @@ export default class LargeVideoManager {
23 23
         this.eventEmitter = emitter;
24 24
 
25 25
         this.state = VIDEO_CONTAINER_TYPE;
26
+        // FIXME: We are passing resizeContainer as parameter which is calling
27
+        // Container.resize. Probably there's better way to implement this.
26 28
         this.videoContainer = new VideoContainer(
27 29
             () => this.resizeContainer(VIDEO_CONTAINER_TYPE), emitter);
28 30
         this.addContainer(VIDEO_CONTAINER_TYPE, this.videoContainer);

+ 18
- 4
modules/UI/videolayout/VideoContainer.js View File

@@ -164,12 +164,20 @@ export class VideoContainer extends LargeContainer {
164 164
         return getStreamOwnerId(this.stream);
165 165
     }
166 166
 
167
-    constructor (onPlay, emitter) {
167
+    /**
168
+     * Creates new VideoContainer instance.
169
+     * @param resizeContainer {Function} function that takes care of the size
170
+     * of the video container.
171
+     * @param emitter {EventEmitter} the event emitter that will be used by
172
+     * this instance.
173
+     */
174
+    constructor (resizeContainer, emitter) {
168 175
         super();
169 176
         this.stream = null;
170 177
         this.videoType = null;
171 178
         this.localFlipX = true;
172 179
         this.emitter = emitter;
180
+        this.resizeContainer = resizeContainer;
173 181
 
174 182
         this.isVisible = false;
175 183
 
@@ -199,8 +207,8 @@ export class VideoContainer extends LargeContainer {
199 207
         this.avatarHeight = $("#dominantSpeakerAvatar").height();
200 208
 
201 209
         var onPlayCallback = function (event) {
202
-            if (typeof onPlay === 'function') {
203
-                onPlay(event);
210
+            if (typeof resizeContainer === 'function') {
211
+                resizeContainer(event);
204 212
             }
205 213
             this.wasVideoRendered = true;
206 214
         }.bind(this);
@@ -336,8 +344,14 @@ export class VideoContainer extends LargeContainer {
336 344
      * @param {string} videoType video type
337 345
      */
338 346
     setStream (stream, videoType) {
339
-
340 347
         if (this.stream === stream) {
348
+            // Handles the use case for the remote participants when the
349
+            // videoType is received with delay after turning on/off the
350
+            // desktop sharing.
351
+            if(this.videoType !== videoType) {
352
+                this.videoType = videoType;
353
+                this.resizeContainer();
354
+            }
341 355
             return;
342 356
         } else {
343 357
             // The stream has changed, so the image will be lost on detach

Loading…
Cancel
Save