Просмотр исходного кода

video-layout: fix calculating tile size for recorder

When the reccorder joins, they have a local participant, which is not rendered,
so don't count it towards the partcipant count used for computing the tile
sizes.
j8
Saúl Ibarra Corretgé 5 лет назад
Родитель
Сommit
b13200ac92

+ 2
- 2
react/features/filmstrip/subscriber.web.js Просмотреть файл

@@ -15,7 +15,7 @@ StateListenerRegistry.register(
15 15
         const state = store.getState();
16 16
 
17 17
         if (shouldDisplayTileView(state)) {
18
-            const gridDimensions = getTileViewGridDimensions(state['features/base/participants'].length);
18
+            const gridDimensions = getTileViewGridDimensions(state);
19 19
             const oldGridDimensions = state['features/filmstrip'].tileViewDimensions.gridDimensions;
20 20
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
21 21
 
@@ -41,7 +41,7 @@ StateListenerRegistry.register(
41 41
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
42 42
 
43 43
             store.dispatch(setTileViewDimensions(
44
-                getTileViewGridDimensions(state['features/base/participants'].length), {
44
+                getTileViewGridDimensions(state), {
45 45
                     clientHeight,
46 46
                     clientWidth
47 47
                 }));

+ 7
- 2
react/features/video-layout/functions.js Просмотреть файл

@@ -39,13 +39,18 @@ export function getMaxColumnCount() {
39 39
  * equal count of tiles for height and width, until maxColumn is reached in
40 40
  * which rows will be added but no more columns.
41 41
  *
42
- * @param {number} numberOfParticipants - The number of participants including the fake participants.
42
+ * @param {Object} state - The redux store state.
43 43
  * @param {number} maxColumns - The maximum number of columns that can be
44 44
  * displayed.
45 45
  * @returns {Object} An object is return with the desired number of columns,
46 46
  * rows, and visible rows (the rest should overflow) for the tile view layout.
47 47
  */
48
-export function getTileViewGridDimensions(numberOfParticipants: number, maxColumns: number = getMaxColumnCount()) {
48
+export function getTileViewGridDimensions(state: Object, maxColumns: number = getMaxColumnCount()) {
49
+    // When in tile view mode, we must discount ourselves (the local participant) because our
50
+    // tile is not visible.
51
+    const { iAmRecorder } = state['features/base/config'];
52
+    const numberOfParticipants = state['features/base/participants'].length - (iAmRecorder ? 1 : 0);
53
+
49 54
     const columnsToMaintainASquare = Math.ceil(Math.sqrt(numberOfParticipants));
50 55
     const columns = Math.min(columnsToMaintainASquare, maxColumns);
51 56
     const rows = Math.ceil(numberOfParticipants / columns);

Загрузка…
Отмена
Сохранить