|
@@ -170,14 +170,24 @@ class Filmstrip extends PureComponent<Props> {
|
170
|
170
|
* @returns {void}
|
171
|
171
|
*/
|
172
|
172
|
_onViewableItemsChanged({ viewableItems = [] }) {
|
173
|
|
- const indexArray: Array<number> = viewableItems.map(i => i.index);
|
174
|
|
-
|
175
|
|
- // If the local video placed at the beginning we need to shift the start index of the remoteParticipants array
|
176
|
|
- // with 1 because and in the same time we don't need to adjust the end index because the end index will not be
|
177
|
|
- // included.
|
178
|
|
- const startIndex
|
179
|
|
- = this._separateLocalThumbnail ? Math.min(...indexArray) : Math.max(Math.min(...indexArray) - 1, 0);
|
180
|
|
- const endIndex = Math.max(...indexArray) + (this._separateLocalThumbnail ? 1 : 0);
|
|
173
|
+ if (!this._separateLocalThumbnail && viewableItems[0]?.index === 0) {
|
|
174
|
+ // Skip the local thumbnail.
|
|
175
|
+ viewableItems.shift();
|
|
176
|
+ }
|
|
177
|
+
|
|
178
|
+ if (viewableItems.length === 0) {
|
|
179
|
+ // User might be fast-scrolling, it will stabilize.
|
|
180
|
+ return;
|
|
181
|
+ }
|
|
182
|
+
|
|
183
|
+ let startIndex = viewableItems[0].index;
|
|
184
|
+ let endIndex = viewableItems[viewableItems.length - 1].index;
|
|
185
|
+
|
|
186
|
+ if (!this._separateLocalThumbnail) {
|
|
187
|
+ // We are off by one in the remote participants array.
|
|
188
|
+ startIndex -= 1;
|
|
189
|
+ endIndex -= 1;
|
|
190
|
+ }
|
181
|
191
|
|
182
|
192
|
this.props.dispatch(setVisibleRemoteParticipants(startIndex, endIndex));
|
183
|
193
|
}
|