浏览代码

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

Fix width when the filmstrip is resized
master
Robert Pintilii 3 年前
父节点
当前提交
6820f48fd2
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 21 次插入10 次删除
  1. 21
    10
      modules/UI/videolayout/VideoContainer.js

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

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

正在加载...
取消
保存