瀏覽代碼

fix(screensharing) Fix screensharing container width (#11089)

Fix width when the filmstrip is resized
master
Robert Pintilii 3 年之前
父節點
當前提交
6820f48fd2
No account linked to committer's email address
共有 1 個文件被更改,包括 21 次插入10 次删除
  1. 21
    10
      modules/UI/videolayout/VideoContainer.js

+ 21
- 10
modules/UI/videolayout/VideoContainer.js 查看文件

@@ -6,6 +6,7 @@ import ReactDOM from 'react-dom';
6 6
 
7 7
 import { browser } from '../../../react/features/base/lib-jitsi-meet';
8 8
 import { isTestModeEnabled } from '../../../react/features/base/testing';
9
+import { FILMSTRIP_BREAKPOINT } from '../../../react/features/filmstrip';
9 10
 import { ORIENTATION, LargeVideoBackground, updateLastLargeVideoMediaEvent } from '../../../react/features/large-video';
10 11
 import { LAYOUTS, getCurrentLayout } from '../../../react/features/video-layout';
11 12
 /* eslint-enable no-unused-vars */
@@ -37,13 +38,15 @@ const containerEvents = [
37 38
  * @param videoHeight the height of the video to position
38 39
  * @param videoSpaceWidth the width of the available space
39 40
  * @param videoSpaceHeight the height of the available space
41
+ * @param subtractFilmstrip whether to subtract the filmstrip or not
40 42
  * @return an array with 2 elements, the video width and the video height
41 43
  */
42 44
 function computeDesktopVideoSize( // eslint-disable-line max-params
43 45
         videoWidth,
44 46
         videoHeight,
45 47
         videoSpaceWidth,
46
-        videoSpaceHeight) {
48
+        videoSpaceHeight,
49
+        subtractFilmstrip) {
47 50
     if (videoWidth === 0 || videoHeight === 0 || videoSpaceWidth === 0 || videoSpaceHeight === 0) {
48 51
         // Avoid NaN values caused by division by 0.
49 52
         return [ 0, 0 ];
@@ -54,8 +57,10 @@ function computeDesktopVideoSize( // eslint-disable-line max-params
54 57
     let availableHeight = Math.max(videoHeight, videoSpaceHeight);
55 58
 
56 59
     if (interfaceConfig.VERTICAL_FILMSTRIP) {
57
-        // eslint-disable-next-line no-param-reassign
58
-        videoSpaceWidth -= Filmstrip.getVerticalFilmstripWidth();
60
+        if (subtractFilmstrip) {
61
+            // eslint-disable-next-line no-param-reassign
62
+            videoSpaceWidth -= Filmstrip.getVerticalFilmstripWidth();
63
+        }
59 64
     } else {
60 65
         // eslint-disable-next-line no-param-reassign
61 66
         videoSpaceHeight -= Filmstrip.getFilmstripHeight();
@@ -307,16 +312,18 @@ export class VideoContainer extends LargeContainer {
307 312
      * Calculate optimal video size for specified container size.
308 313
      * @param {number} containerWidth container width
309 314
      * @param {number} containerHeight container height
315
+     * @param {number} verticalFilmstripWidth current width of the vertical filmstrip
310 316
      * @returns {{availableWidth, availableHeight}}
311 317
      */
312
-    _getVideoSize(containerWidth, containerHeight) {
318
+    _getVideoSize(containerWidth, containerHeight, verticalFilmstripWidth) {
313 319
         const { width, height } = this.getStreamSize();
314 320
 
315 321
         if (this.stream && this.isScreenSharing()) {
316 322
             return computeDesktopVideoSize(width,
317 323
                 height,
318 324
                 containerWidth,
319
-                containerHeight);
325
+                containerHeight,
326
+                verticalFilmstripWidth < FILMSTRIP_BREAKPOINT);
320 327
         }
321 328
 
322 329
         return computeCameraVideoSize(width,
@@ -334,14 +341,15 @@ export class VideoContainer extends LargeContainer {
334 341
      * @param {number} height video height
335 342
      * @param {number} containerWidth container width
336 343
      * @param {number} containerHeight container height
344
+     * @param {number} verticalFilmstripWidth current width of the vertical filmstrip
337 345
      * @returns {{horizontalIndent, verticalIndent}}
338 346
      */
339
-    getVideoPosition(width, height, containerWidth, containerHeight) {
347
+    getVideoPosition(width, height, containerWidth, containerHeight, verticalFilmstripWidth) {
340 348
         let containerWidthToUse = containerWidth;
341 349
 
342 350
         /* eslint-enable max-params */
343 351
         if (this.stream && this.isScreenSharing()) {
344
-            if (interfaceConfig.VERTICAL_FILMSTRIP) {
352
+            if (interfaceConfig.VERTICAL_FILMSTRIP && verticalFilmstripWidth < FILMSTRIP_BREAKPOINT) {
345 353
                 containerWidthToUse -= Filmstrip.getVerticalFilmstripWidth();
346 354
             }
347 355
 
@@ -401,7 +409,10 @@ export class VideoContainer extends LargeContainer {
401 409
         if (this.$video.length === 0) {
402 410
             return;
403 411
         }
404
-        const currentLayout = getCurrentLayout(APP.store.getState());
412
+        const state = APP.store.getState();
413
+        const currentLayout = getCurrentLayout(state);
414
+
415
+        const verticalFilmstripWidth = state['features/filmstrip'].width?.current;
405 416
 
406 417
         if (currentLayout === LAYOUTS.TILE_VIEW) {
407 418
             // We don't need to resize the large video since it won't be displayed and we'll resize when returning back
@@ -411,7 +422,7 @@ export class VideoContainer extends LargeContainer {
411 422
 
412 423
         this.positionRemoteStatusMessages();
413 424
 
414
-        const [ width, height ] = this._getVideoSize(containerWidth, containerHeight);
425
+        const [ width, height ] = this._getVideoSize(containerWidth, containerHeight, verticalFilmstripWidth);
415 426
 
416 427
         if (width === 0 || height === 0) {
417 428
             // We don't need to set 0 for width or height since the visibility is controlled by the visibility css prop
@@ -432,7 +443,7 @@ export class VideoContainer extends LargeContainer {
432 443
         this._updateBackground();
433 444
 
434 445
         const { horizontalIndent, verticalIndent }
435
-            = this.getVideoPosition(width, height, containerWidth, containerHeight);
446
+            = this.getVideoPosition(width, height, containerWidth, containerHeight, verticalFilmstripWidth);
436 447
 
437 448
         this.$wrapper.animate({
438 449
             width,

Loading…
取消
儲存