Browse Source

feat(filmstrip): Don't reorder in small meetings.

master
Hristo Terezov 3 years ago
parent
commit
16bcb1b217

+ 31
- 10
react/features/filmstrip/actions.web.js View File

4
 import {
4
 import {
5
     getLocalParticipant,
5
     getLocalParticipant,
6
     getParticipantById,
6
     getParticipantById,
7
+    getRemoteParticipantCount,
7
     pinParticipant
8
     pinParticipant
8
 } from '../base/participants';
9
 } from '../base/participants';
9
 import { shouldHideSelfView } from '../base/settings/functions.any';
10
 import { shouldHideSelfView } from '../base/settings/functions.any';
117
         const disableSelfView = shouldHideSelfView(state);
118
         const disableSelfView = shouldHideSelfView(state);
118
         const resizableFilmstrip = isFilmstripResizable(state);
119
         const resizableFilmstrip = isFilmstripResizable(state);
119
         const _verticalViewGrid = showGridInVerticalView(state);
120
         const _verticalViewGrid = showGridInVerticalView(state);
121
+        const numberOfRemoteParticipants = getRemoteParticipantCount(state);
120
 
122
 
121
         let gridView = {};
123
         let gridView = {};
122
         let thumbnails = {};
124
         let thumbnails = {};
123
         let filmstripDimensions = {};
125
         let filmstripDimensions = {};
126
+        let hasScroll = false;
127
+        let remoteVideosContainerWidth;
128
+        let remoteVideosContainerHeight;
124
 
129
 
125
         // grid view in the vertical filmstrip
130
         // grid view in the vertical filmstrip
126
         if (_verticalViewGrid) {
131
         if (_verticalViewGrid) {
143
                 numberOfVisibleTiles
148
                 numberOfVisibleTiles
144
             });
149
             });
145
             const thumbnailsTotalHeight = rows * (TILE_VERTICAL_MARGIN + height);
150
             const thumbnailsTotalHeight = rows * (TILE_VERTICAL_MARGIN + height);
146
-            const hasScroll = clientHeight < thumbnailsTotalHeight;
151
+
152
+            hasScroll = clientHeight < thumbnailsTotalHeight;
147
             const widthOfFilmstrip = (columns * (TILE_HORIZONTAL_MARGIN + width)) + (hasScroll ? SCROLL_SIZE : 0);
153
             const widthOfFilmstrip = (columns * (TILE_HORIZONTAL_MARGIN + width)) + (hasScroll ? SCROLL_SIZE : 0);
148
             const filmstripHeight = Math.min(clientHeight - TILE_VIEW_GRID_VERTICAL_MARGIN, thumbnailsTotalHeight);
154
             const filmstripHeight = Math.min(clientHeight - TILE_VIEW_GRID_VERTICAL_MARGIN, thumbnailsTotalHeight);
149
 
155
 
165
             };
171
             };
166
         } else {
172
         } else {
167
             thumbnails = calculateThumbnailSizeForVerticalView(clientWidth, filmstripWidth.current, resizableFilmstrip);
173
             thumbnails = calculateThumbnailSizeForVerticalView(clientWidth, filmstripWidth.current, resizableFilmstrip);
174
+
175
+            remoteVideosContainerWidth
176
+                = thumbnails?.local?.width + TILE_VERTICAL_CONTAINER_HORIZONTAL_MARGIN + SCROLL_SIZE;
177
+            remoteVideosContainerHeight
178
+                = clientHeight - (disableSelfView ? 0 : thumbnails?.local?.height) - VERTICAL_FILMSTRIP_VERTICAL_MARGIN;
179
+            hasScroll
180
+                = remoteVideosContainerHeight
181
+                    < (thumbnails?.remote.height + TILE_VERTICAL_MARGIN) * numberOfRemoteParticipants;
168
         }
182
         }
169
 
183
 
170
         dispatch({
184
         dispatch({
172
             dimensions: {
186
             dimensions: {
173
                 ...thumbnails,
187
                 ...thumbnails,
174
                 remoteVideosContainer: _verticalViewGrid ? filmstripDimensions : {
188
                 remoteVideosContainer: _verticalViewGrid ? filmstripDimensions : {
175
-                    width: thumbnails?.local?.width
176
-                        + TILE_VERTICAL_CONTAINER_HORIZONTAL_MARGIN + SCROLL_SIZE,
177
-                    height: clientHeight - (disableSelfView ? 0 : thumbnails?.local?.height)
178
-                        - VERTICAL_FILMSTRIP_VERTICAL_MARGIN
189
+                    width: remoteVideosContainerWidth,
190
+                    height: remoteVideosContainerHeight
179
                 },
191
                 },
180
-                gridView
192
+                gridView,
193
+                hasScroll
181
             }
194
             }
182
         });
195
         });
183
     };
196
     };
194
         const { clientHeight = 0, clientWidth = 0 } = state['features/base/responsive-ui'];
207
         const { clientHeight = 0, clientWidth = 0 } = state['features/base/responsive-ui'];
195
         const disableSelfView = shouldHideSelfView(state);
208
         const disableSelfView = shouldHideSelfView(state);
196
         const thumbnails = calculateThumbnailSizeForHorizontalView(clientHeight);
209
         const thumbnails = calculateThumbnailSizeForHorizontalView(clientHeight);
210
+        const remoteVideosContainerWidth
211
+            = clientWidth - (disableSelfView ? 0 : thumbnails?.local?.width) - HORIZONTAL_FILMSTRIP_MARGIN;
212
+        const remoteVideosContainerHeight
213
+            = thumbnails?.local?.height + TILE_VERTICAL_MARGIN + STAGE_VIEW_THUMBNAIL_VERTICAL_BORDER + SCROLL_SIZE;
214
+        const numberOfRemoteParticipants = getRemoteParticipantCount(state);
215
+        const hasScroll
216
+            = remoteVideosContainerHeight
217
+                < (thumbnails?.remote.width + TILE_HORIZONTAL_MARGIN) * numberOfRemoteParticipants;
197
 
218
 
198
         dispatch({
219
         dispatch({
199
             type: SET_HORIZONTAL_VIEW_DIMENSIONS,
220
             type: SET_HORIZONTAL_VIEW_DIMENSIONS,
200
             dimensions: {
221
             dimensions: {
201
                 ...thumbnails,
222
                 ...thumbnails,
202
                 remoteVideosContainer: {
223
                 remoteVideosContainer: {
203
-                    width: clientWidth - (disableSelfView ? 0 : thumbnails?.local?.width) - HORIZONTAL_FILMSTRIP_MARGIN,
204
-                    height: thumbnails?.local?.height
205
-                        + TILE_VERTICAL_MARGIN + STAGE_VIEW_THUMBNAIL_VERTICAL_BORDER + SCROLL_SIZE
206
-                }
224
+                    width: remoteVideosContainerWidth,
225
+                    height: remoteVideosContainerHeight
226
+                },
227
+                hasScroll
207
             }
228
             }
208
         });
229
         });
209
     };
230
     };

+ 22
- 6
react/features/filmstrip/components/web/Filmstrip.js View File

88
      */
88
      */
89
     _filmstripHeight: number,
89
     _filmstripHeight: number,
90
 
90
 
91
+    /**
92
+     * Whether or not we have scroll on the filmstrip.
93
+     */
94
+    _hasScroll: boolean,
95
+
91
     /**
96
     /**
92
      * Whether this is a recorder or not.
97
      * Whether this is a recorder or not.
93
      */
98
      */
567
             _currentLayout,
572
             _currentLayout,
568
             _filmstripHeight,
573
             _filmstripHeight,
569
             _filmstripWidth,
574
             _filmstripWidth,
575
+            _hasScroll,
570
             _remoteParticipantsLength,
576
             _remoteParticipantsLength,
571
             _resizableFilmstrip,
577
             _resizableFilmstrip,
572
             _rows,
578
             _rows,
620
 
626
 
621
         if (_currentLayout === LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW) {
627
         if (_currentLayout === LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW) {
622
             const itemSize = _thumbnailWidth + TILE_HORIZONTAL_MARGIN;
628
             const itemSize = _thumbnailWidth + TILE_HORIZONTAL_MARGIN;
623
-            const isNotOverflowing = (_remoteParticipantsLength * itemSize) <= _filmstripWidth;
629
+            const isNotOverflowing = !_hasScroll;
624
 
630
 
625
             props.itemSize = itemSize;
631
             props.itemSize = itemSize;
626
 
632
 
632
 
638
 
633
         } else if (_currentLayout === LAYOUTS.VERTICAL_FILMSTRIP_VIEW) {
639
         } else if (_currentLayout === LAYOUTS.VERTICAL_FILMSTRIP_VIEW) {
634
             const itemSize = _thumbnailHeight + TILE_VERTICAL_MARGIN;
640
             const itemSize = _thumbnailHeight + TILE_VERTICAL_MARGIN;
635
-            const isNotOverflowing = (_remoteParticipantsLength * itemSize) <= _filmstripHeight;
641
+            const isNotOverflowing = !_hasScroll;
636
 
642
 
637
             if (isNotOverflowing) {
643
             if (isNotOverflowing) {
638
                 props.className += ' is-not-overflowing';
644
                 props.className += ' is-not-overflowing';
768
         gridDimensions: dimensions = {},
774
         gridDimensions: dimensions = {},
769
         filmstripHeight,
775
         filmstripHeight,
770
         filmstripWidth,
776
         filmstripWidth,
771
-        hasScroll = false,
777
+        hasScroll: tileViewHasScroll,
772
         thumbnailSize: tileViewThumbnailSize
778
         thumbnailSize: tileViewThumbnailSize
773
     } = state['features/filmstrip'].tileViewDimensions;
779
     } = state['features/filmstrip'].tileViewDimensions;
774
     const _currentLayout = getCurrentLayout(state);
780
     const _currentLayout = getCurrentLayout(state);
776
     const _resizableFilmstrip = isFilmstripResizable(state);
782
     const _resizableFilmstrip = isFilmstripResizable(state);
777
     const _verticalViewGrid = showGridInVerticalView(state);
783
     const _verticalViewGrid = showGridInVerticalView(state);
778
     let gridDimensions = dimensions;
784
     let gridDimensions = dimensions;
785
+    let _hasScroll = false;
779
 
786
 
780
     const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
787
     const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
781
     const availableSpace = clientHeight - filmstripHeight;
788
     const availableSpace = clientHeight - filmstripHeight;
806
 
813
 
807
     switch (_currentLayout) {
814
     switch (_currentLayout) {
808
     case LAYOUTS.TILE_VIEW:
815
     case LAYOUTS.TILE_VIEW:
809
-        if (hasScroll) {
816
+        _hasScroll = Boolean(tileViewHasScroll);
817
+        if (_hasScroll) {
810
             videosClassName += ' has-scroll';
818
             videosClassName += ' has-scroll';
811
         }
819
         }
812
         _thumbnailSize = tileViewThumbnailSize;
820
         _thumbnailSize = tileViewThumbnailSize;
814
         remoteFilmstripWidth = filmstripWidth;
822
         remoteFilmstripWidth = filmstripWidth;
815
         break;
823
         break;
816
     case LAYOUTS.VERTICAL_FILMSTRIP_VIEW: {
824
     case LAYOUTS.VERTICAL_FILMSTRIP_VIEW: {
817
-        const { remote, remoteVideosContainer, gridView } = state['features/filmstrip'].verticalViewDimensions;
825
+        const {
826
+            remote,
827
+            remoteVideosContainer,
828
+            gridView,
829
+            hasScroll
830
+        } = state['features/filmstrip'].verticalViewDimensions;
818
 
831
 
832
+        _hasScroll = Boolean(hasScroll);
819
         remoteFilmstripHeight = remoteVideosContainer?.height - (!_verticalViewGrid && shouldReduceHeight
833
         remoteFilmstripHeight = remoteVideosContainer?.height - (!_verticalViewGrid && shouldReduceHeight
820
             ? TOOLBAR_HEIGHT : 0);
834
             ? TOOLBAR_HEIGHT : 0);
821
         remoteFilmstripWidth = remoteVideosContainer?.width;
835
         remoteFilmstripWidth = remoteVideosContainer?.width;
833
         break;
847
         break;
834
     }
848
     }
835
     case LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW: {
849
     case LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW: {
836
-        const { remote, remoteVideosContainer } = state['features/filmstrip'].horizontalViewDimensions;
850
+        const { remote, remoteVideosContainer, hasScroll } = state['features/filmstrip'].horizontalViewDimensions;
837
 
851
 
852
+        _hasScroll = Boolean(hasScroll);
838
         _thumbnailSize = remote;
853
         _thumbnailSize = remote;
839
         remoteFilmstripHeight = remoteVideosContainer?.height;
854
         remoteFilmstripHeight = remoteVideosContainer?.height;
840
         remoteFilmstripWidth = remoteVideosContainer?.width;
855
         remoteFilmstripWidth = remoteVideosContainer?.width;
849
         _disableSelfView: disableSelfView,
864
         _disableSelfView: disableSelfView,
850
         _filmstripHeight: remoteFilmstripHeight,
865
         _filmstripHeight: remoteFilmstripHeight,
851
         _filmstripWidth: remoteFilmstripWidth,
866
         _filmstripWidth: remoteFilmstripWidth,
867
+        _hasScroll,
852
         _iAmRecorder: Boolean(iAmRecorder),
868
         _iAmRecorder: Boolean(iAmRecorder),
853
         _isFilmstripButtonEnabled: isButtonEnabled('filmstrip', state),
869
         _isFilmstripButtonEnabled: isButtonEnabled('filmstrip', state),
854
         _isToolboxVisible: isToolboxVisible(state),
870
         _isToolboxVisible: isToolboxVisible(state),

+ 2
- 3
react/features/filmstrip/functions.any.js View File

1
 // @flow
1
 // @flow
2
 
2
 
3
 import { setRemoteParticipants } from './actions';
3
 import { setRemoteParticipants } from './actions';
4
+import { isReorderingEnabled } from './functions';
4
 
5
 
5
 /**
6
 /**
6
  * Computes the reorderd list of the remote participants.
7
  * Computes the reorderd list of the remote participants.
12
  */
13
  */
13
 export function updateRemoteParticipants(store: Object, participantId: ?number) {
14
 export function updateRemoteParticipants(store: Object, participantId: ?number) {
14
     const state = store.getState();
15
     const state = store.getState();
15
-    const { testing = {} } = state['features/base/config'];
16
-    const enableThumbnailReordering = testing.enableThumbnailReordering ?? true;
17
     let reorderedParticipants = [];
16
     let reorderedParticipants = [];
18
 
17
 
19
-    if (!enableThumbnailReordering) {
18
+    if (!isReorderingEnabled(state)) {
20
         if (participantId) {
19
         if (participantId) {
21
             const { remoteParticipants } = state['features/filmstrip'];
20
             const { remoteParticipants } = state['features/filmstrip'];
22
 
21
 

+ 14
- 0
react/features/filmstrip/functions.native.js View File

88
 
88
 
89
     return Math.min(3, participantCount);
89
     return Math.min(3, participantCount);
90
 }
90
 }
91
+
92
+/**
93
+ * Returns true if thumbnail reordering is enabled and false otherwise.
94
+ *
95
+ * @param {Object} state - The redux state.
96
+ * @returns {boolean} - True if thumbnail reordering is enabled and false otherwise.
97
+ */
98
+export function isReorderingEnabled(state) {
99
+    const { testing = {} } = state['features/base/config'];
100
+    const enableThumbnailReordering = testing.enableThumbnailReordering ?? true;
101
+
102
+    return enableThumbnailReordering;
103
+}
104
+

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

601
 
601
 
602
     return maxWidth;
602
     return maxWidth;
603
 }
603
 }
604
+
605
+/**
606
+ * Returns true if thumbnail reordering is enabled and false otherwise.
607
+ * Note: The function will return false if all participants are displayed on the screen.
608
+ *
609
+ * @param {Object} state - The redux state.
610
+ * @returns {boolean} - True if thumbnail reordering is enabled and false otherwise.
611
+ */
612
+export function isReorderingEnabled(state) {
613
+    const { testing = {} } = state['features/base/config'];
614
+    const enableThumbnailReordering = testing.enableThumbnailReordering ?? true;
615
+
616
+    return enableThumbnailReordering && isFilmstripScollVisible(state);
617
+}
618
+
619
+/**
620
+ * Returns true if the scroll is displayed and false otherwise.
621
+ *
622
+ * @param {Object} state - The redux state.
623
+ * @returns {boolean} - True if the scroll is displayed and false otherwise.
624
+ */
625
+export function isFilmstripScollVisible(state) {
626
+    const _currentLayout = getCurrentLayout(state);
627
+    let hasScroll = false;
628
+
629
+    switch (_currentLayout) {
630
+    case LAYOUTS.TILE_VIEW:
631
+        ({ hasScroll = false } = state['features/filmstrip'].tileViewDimensions);
632
+        break;
633
+    case LAYOUTS.VERTICAL_FILMSTRIP_VIEW: {
634
+        ({ hasScroll = false } = state['features/filmstrip'].verticalViewDimensions);
635
+        break;
636
+    }
637
+    case LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW: {
638
+        ({ hasScroll = false } = state['features/filmstrip'].horizontalViewDimensions);
639
+        break;
640
+    }
641
+    }
642
+
643
+    return hasScroll;
644
+}

+ 8
- 1
react/features/filmstrip/subscriber.web.js View File

19
     ASPECT_RATIO_BREAKPOINT,
19
     ASPECT_RATIO_BREAKPOINT,
20
     DISPLAY_DRAWER_THRESHOLD
20
     DISPLAY_DRAWER_THRESHOLD
21
 } from './constants';
21
 } from './constants';
22
-import { isFilmstripResizable } from './functions.web';
22
+import { isFilmstripResizable, isFilmstripScollVisible, updateRemoteParticipants } from './functions';
23
 import './subscriber.any';
23
 import './subscriber.any';
24
 
24
 
25
 
25
 
140
     /* listener */(_, store) => {
140
     /* listener */(_, store) => {
141
         store.dispatch(setVerticalViewDimensions());
141
         store.dispatch(setVerticalViewDimensions());
142
     });
142
     });
143
+
144
+/**
145
+ * Listens for changes in the filmstrip scroll visibility.
146
+ */
147
+StateListenerRegistry.register(
148
+    /* selector */ state => isFilmstripScollVisible(state),
149
+    /* listener */ (_, store) => updateRemoteParticipants(store));

Loading…
Cancel
Save