Bläddra i källkod

fix(LargeVideoManager): large video resizing

Distinguish between preferred and calculated width/height
values.
master
paweldomas 4 år sedan
förälder
incheckning
7f17c2eceb
1 ändrade filer med 32 tillägg och 2 borttagningar
  1. 32
    2
      modules/UI/videolayout/LargeVideoManager.js

+ 32
- 2
modules/UI/videolayout/LargeVideoManager.js Visa fil

@@ -67,7 +67,30 @@ export default class LargeVideoManager {
67 67
         // use the same video container to handle desktop tracks
68 68
         this.addContainer(DESKTOP_CONTAINER_TYPE, this.videoContainer);
69 69
 
70
+        /**
71
+         * The preferred width passed as an argument to {@link updateContainerSize}.
72
+         *
73
+         * @type {number|undefined}
74
+         */
75
+        this.preferredWidth = undefined;
76
+
77
+        /**
78
+         * The preferred height passed as an argument to {@link updateContainerSize}.
79
+         *
80
+         * @type {number|undefined}
81
+         */
82
+        this.preferredHeight = undefined;
83
+
84
+        /**
85
+         * The calculated width that will be used for the large video.
86
+         * @type {number}
87
+         */
70 88
         this.width = 0;
89
+
90
+        /**
91
+         * The calculated height that will be used for the large video.
92
+         * @type {number}
93
+         */
71 94
         this.height = 0;
72 95
 
73 96
         /**
@@ -323,7 +346,14 @@ export default class LargeVideoManager {
323 346
      * Update container size.
324 347
      */
325 348
     updateContainerSize(width, height) {
326
-        let widthToUse = width ?? (this.width > 0 ? this.width : window.innerWidth);
349
+        if (typeof width === 'number') {
350
+            this.preferredWidth = width;
351
+        }
352
+        if (typeof height === 'number') {
353
+            this.preferredHeight = height;
354
+        }
355
+
356
+        let widthToUse = this.preferredWidth || window.innerWidth;
327 357
         const { isOpen } = APP.store.getState()['features/chat'];
328 358
 
329 359
         /**
@@ -340,7 +370,7 @@ export default class LargeVideoManager {
340 370
         }
341 371
 
342 372
         this.width = widthToUse;
343
-        this.height = height ?? (this.height > 0 ? this.height : window.innerHeight);
373
+        this.height = this.preferredHeight || window.innerHeight;
344 374
     }
345 375
 
346 376
     /**

Laddar…
Avbryt
Spara