Browse Source

fix(large-video): Resize calculations.

Since the verical filmstrip doesn't set its width explicitly anymore,
calculating the available area for the large video based on the
filmstrip width retrieved from the HTML element was wrong
in the cases when the rendering and cleanup of the filmstrip hasn't
finish yet. For example when switching from tile view to stage view.
master
Hristo Terezov 5 years ago
parent
commit
06fa175a6c

+ 1
- 1
modules/UI/UI.js View File

@@ -166,7 +166,7 @@ UI.start = function() {
166 166
     // resizeVideoArea) because the animation is not visible anyway. Plus with
167 167
     // the current dom layout, the quality label is part of the video layout and
168 168
     // will be seen animating in.
169
-    VideoLayout.resizeVideoArea(true, false);
169
+    VideoLayout.resizeVideoArea();
170 170
 
171 171
     sharedVideoManager = new SharedVideoManager(eventEmitter);
172 172
 

+ 1
- 1
modules/UI/etherpad/Etherpad.js View File

@@ -120,7 +120,7 @@ class Etherpad extends LargeContainer {
120 120
 
121 121
         if (interfaceConfig.VERTICAL_FILMSTRIP) {
122 122
             height = containerHeight - getToolboxHeight();
123
-            width = containerWidth - Filmstrip.getFilmstripWidth();
123
+            width = containerWidth - Filmstrip.getVerticalFilmstripWidth();
124 124
         } else {
125 125
             height = containerHeight - Filmstrip.getFilmstripHeight();
126 126
             width = containerWidth;

+ 1
- 1
modules/UI/shared_video/SharedVideo.js View File

@@ -661,7 +661,7 @@ class SharedVideoContainer extends LargeContainer {
661 661
 
662 662
         if (interfaceConfig.VERTICAL_FILMSTRIP) {
663 663
             height = containerHeight - getToolboxHeight();
664
-            width = containerWidth - Filmstrip.getFilmstripWidth();
664
+            width = containerWidth - Filmstrip.getVerticalFilmstripWidth();
665 665
         } else {
666 666
             height = containerHeight - Filmstrip.getFilmstripHeight();
667 667
             width = containerWidth;

+ 6
- 11
modules/UI/videolayout/Filmstrip.js View File

@@ -1,6 +1,6 @@
1 1
 /* global $, APP, interfaceConfig */
2 2
 
3
-import { isFilmstripVisible } from '../../../react/features/filmstrip';
3
+import { getVerticalFilmstripVisibleAreaWidth, isFilmstripVisible } from '../../../react/features/filmstrip';
4 4
 
5 5
 const Filmstrip = {
6 6
     /**
@@ -19,17 +19,12 @@ const Filmstrip = {
19 19
     },
20 20
 
21 21
     /**
22
-     * Returns the width of filmstip
23
-     * @returns {number} width
22
+     * Returns the width of the vertical filmstip if the filmstrip is visible and 0 otherwise.
23
+     *
24
+     * @returns {number} - The width of the vertical filmstip if the filmstrip is visible and 0 otherwise.
24 25
      */
25
-    getFilmstripWidth() {
26
-        const filmstrip = $('#remoteVideos');
27
-
28
-        return isFilmstripVisible(APP.store)
29
-            ? filmstrip.outerWidth()
30
-                - parseInt(filmstrip.css('paddingLeft'), 10)
31
-                - parseInt(filmstrip.css('paddingRight'), 10)
32
-            : 0;
26
+    getVerticalFilmstripWidth() {
27
+        return isFilmstripVisible(APP.store) ? getVerticalFilmstripVisibleAreaWidth() : 0;
33 28
     },
34 29
 
35 30
     /**

+ 2
- 2
modules/UI/videolayout/VideoContainer.js View File

@@ -46,7 +46,7 @@ function computeDesktopVideoSize( // eslint-disable-line max-params
46 46
 
47 47
     if (interfaceConfig.VERTICAL_FILMSTRIP) {
48 48
         // eslint-disable-next-line no-param-reassign
49
-        videoSpaceWidth -= Filmstrip.getFilmstripWidth();
49
+        videoSpaceWidth -= Filmstrip.getVerticalFilmstripWidth();
50 50
     } else {
51 51
         // eslint-disable-next-line no-param-reassign
52 52
         videoSpaceHeight -= Filmstrip.getFilmstripHeight();
@@ -332,7 +332,7 @@ export class VideoContainer extends LargeContainer {
332 332
         /* eslint-enable max-params */
333 333
         if (this.stream && this.isScreenSharing()) {
334 334
             if (interfaceConfig.VERTICAL_FILMSTRIP) {
335
-                containerWidthToUse -= Filmstrip.getFilmstripWidth();
335
+                containerWidthToUse -= Filmstrip.getVerticalFilmstripWidth();
336 336
             }
337 337
 
338 338
             return getCameraVideoPosition(width,

+ 2
- 6
modules/UI/videolayout/VideoLayout.js View File

@@ -542,15 +542,11 @@ const VideoLayout = {
542 542
 
543 543
     /**
544 544
      * Resizes the video area.
545
-     *
546
-     * TODO: Remove the "animate" param as it is no longer passed in as true.
547
-     *
548
-     * @param forceUpdate indicates that hidden thumbnails will be shown
549 545
      */
550
-    resizeVideoArea(animate = false) {
546
+    resizeVideoArea() {
551 547
         if (largeVideo) {
552 548
             largeVideo.updateContainerSize();
553
-            largeVideo.resize(animate);
549
+            largeVideo.resize(false);
554 550
         }
555 551
     },
556 552
 

+ 17
- 0
react/features/filmstrip/functions.web.js View File

@@ -116,3 +116,20 @@ export function calculateThumbnailSizeForTileView({
116 116
         width
117 117
     };
118 118
 }
119
+
120
+/**
121
+ * Returns the width of the visible area (doesn't include the left margin/padding) of the the vertical filmstrip.
122
+ *
123
+ * @returns {number} - The width of the vertical filmstrip.
124
+ */
125
+export function getVerticalFilmstripVisibleAreaWidth() {
126
+    // Adding 11px for the 2px right margin, 2px borders on the left and right and 5px right padding.
127
+    // Also adding 7px for the scrollbar. Note that we are not counting the left margins and paddings because this
128
+    // function is used for calculating the available space and they are invisible.
129
+    // TODO: Check if we can remove the left margins and paddings from the CSS.
130
+    // FIXME: This function is used to calculate the size of the large video, etherpad or shared video. Once everything
131
+    // is reactified this calculation will need to move to the corresponding components.
132
+    const filmstripMaxWidth = (interfaceConfig.FILM_STRIP_MAX_HEIGHT || 120) + 18;
133
+
134
+    return Math.min(filmstripMaxWidth, window.innerWidth);
135
+}

+ 1
- 1
react/features/video-layout/middleware.web.js View File

@@ -74,7 +74,7 @@ MiddlewareRegistry.register(store => next => action => {
74 74
         break;
75 75
 
76 76
     case SET_FILMSTRIP_VISIBLE:
77
-        VideoLayout.resizeVideoArea(true, false);
77
+        VideoLayout.resizeVideoArea();
78 78
         break;
79 79
 
80 80
     case TRACK_ADDED:

Loading…
Cancel
Save