Bläddra i källkod

fix(recorder): tile view

In the case of the recorder we were not taking into account that the
local thumbnail is not visible. This was braking the rendering  and
positioning of the thumbnails in tile view.
master
Hristo Terezov 4 år sedan
förälder
incheckning
e791c4f70c

+ 19
- 7
react/features/filmstrip/components/web/Filmstrip.js Visa fil

@@ -64,6 +64,11 @@ type Props = {
64 64
      */
65 65
     _filmstripHeight: number,
66 66
 
67
+    /**
68
+     * Whether this is a recorder or not.
69
+     */
70
+    _iAmRecorder: boolean,
71
+
67 72
     /**
68 73
      * Whether the filmstrip button is enabled.
69 74
      */
@@ -235,14 +240,14 @@ class Filmstrip extends PureComponent <Props> {
235 240
      * @returns {Object}
236 241
      */
237 242
     _calculateIndices(startIndex, stopIndex) {
238
-        const { _currentLayout, _thumbnailsReordered } = this.props;
243
+        const { _currentLayout, _iAmRecorder, _thumbnailsReordered } = this.props;
239 244
         let start = startIndex;
240 245
         let stop = stopIndex;
241 246
 
242 247
         if (_thumbnailsReordered) {
243 248
             // In tile view, the indices needs to be offset by 1 because the first thumbnail is that of the local
244 249
             // endpoint. The remote participants start from index 1.
245
-            if (_currentLayout === LAYOUTS.TILE_VIEW) {
250
+            if (!_iAmRecorder && _currentLayout === LAYOUTS.TILE_VIEW) {
246 251
                 start = Math.max(startIndex - 1, 0);
247 252
                 stop = stopIndex - 1;
248 253
             }
@@ -294,18 +299,24 @@ class Filmstrip extends PureComponent <Props> {
294 299
      * @returns {string} - The key.
295 300
      */
296 301
     _gridItemKey({ columnIndex, rowIndex }) {
297
-        const { _columns, _remoteParticipants, _remoteParticipantsLength, _thumbnailsReordered } = this.props;
302
+        const {
303
+            _columns,
304
+            _iAmRecorder,
305
+            _remoteParticipants,
306
+            _remoteParticipantsLength,
307
+            _thumbnailsReordered
308
+        } = this.props;
298 309
         const index = (rowIndex * _columns) + columnIndex;
299 310
 
300 311
         // When the thumbnails are reordered, local participant is inserted at index 0.
301 312
         const localIndex = _thumbnailsReordered ? 0 : _remoteParticipantsLength;
302
-        const remoteIndex = _thumbnailsReordered ? index - 1 : index;
313
+        const remoteIndex = _thumbnailsReordered && !_iAmRecorder ? index - 1 : index;
303 314
 
304
-        if (index > _remoteParticipantsLength) {
315
+        if (index > _remoteParticipantsLength - (_iAmRecorder ? 1 : 0)) {
305 316
             return `empty-${index}`;
306 317
         }
307 318
 
308
-        if (index === localIndex) {
319
+        if (!_iAmRecorder && index === localIndex) {
309 320
             return 'local';
310 321
         }
311 322
 
@@ -528,7 +539,7 @@ class Filmstrip extends PureComponent <Props> {
528 539
  */
529 540
 function _mapStateToProps(state) {
530 541
     const toolbarButtons = getToolbarButtons(state);
531
-    const { testing = {} } = state['features/base/config'];
542
+    const { testing = {}, iAmRecorder } = state['features/base/config'];
532 543
     const enableThumbnailReordering = testing.enableThumbnailReordering ?? true;
533 544
     const { visible, remoteParticipants } = state['features/filmstrip'];
534 545
     const reduceHeight = state['features/toolbox'].visible && toolbarButtons.length;
@@ -596,6 +607,7 @@ function _mapStateToProps(state) {
596 607
         _currentLayout,
597 608
         _filmstripHeight: remoteFilmstripHeight,
598 609
         _filmstripWidth: remoteFilmstripWidth,
610
+        _iAmRecorder: Boolean(iAmRecorder),
599 611
         _isFilmstripButtonEnabled: isButtonEnabled('filmstrip', state),
600 612
         _remoteParticipantsLength: remoteParticipants.length,
601 613
         _remoteParticipants: remoteParticipants,

+ 6
- 5
react/features/filmstrip/components/web/ThumbnailWrapper.js Visa fil

@@ -113,26 +113,27 @@ function _mapStateToProps(state, ownProps) {
113 113
         const { columns, rows } = gridDimensions;
114 114
         const index = (rowIndex * columns) + columnIndex;
115 115
         let horizontalOffset;
116
+        const { iAmRecorder } = state['features/base/config'];
117
+        const participantsLenght = remoteParticipantsLength + (iAmRecorder ? 0 : 1);
116 118
 
117 119
         if (rowIndex === rows - 1) { // center the last row
118 120
             const { width: thumbnailWidth } = thumbnailSize;
119
-            const { iAmRecorder } = state['features/base/config'];
120
-            const partialLastRowParticipantsNumber = (remoteParticipantsLength + (iAmRecorder ? 0 : 1)) % columns;
121
+            const partialLastRowParticipantsNumber = participantsLenght % columns;
121 122
 
122 123
             if (partialLastRowParticipantsNumber > 0) {
123 124
                 horizontalOffset = Math.floor((columns - partialLastRowParticipantsNumber) * (thumbnailWidth + 4) / 2);
124 125
             }
125 126
         }
126 127
 
127
-        if (index > remoteParticipantsLength) {
128
+        if (index > participantsLenght - 1) {
128 129
             return {};
129 130
         }
130 131
 
131 132
         // When the thumbnails are reordered, local participant is inserted at index 0.
132 133
         const localIndex = enableThumbnailReordering ? 0 : remoteParticipantsLength;
133
-        const remoteIndex = enableThumbnailReordering ? index - 1 : index;
134
+        const remoteIndex = enableThumbnailReordering && !iAmRecorder ? index - 1 : index;
134 135
 
135
-        if (index === localIndex) {
136
+        if (!iAmRecorder && index === localIndex) {
136 137
             return {
137 138
                 _participantID: 'local',
138 139
                 _horizontalOffset: horizontalOffset

Laddar…
Avbryt
Spara