fix(disableSelfView) Fix issue with remote participant video (#10582)

Fix issue where last participant is shown as inactive when the self view is hidden
This commit is contained in:
Robert Pintilii 2021-12-10 15:16:02 +02:00 committed by GitHub
parent c705dbaa2f
commit f8908c143e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View File

@ -176,7 +176,9 @@ class Filmstrip extends PureComponent<Props> {
* @returns {void} * @returns {void}
*/ */
_onViewableItemsChanged({ viewableItems = [] }) { _onViewableItemsChanged({ viewableItems = [] }) {
if (!this._separateLocalThumbnail && viewableItems[0]?.index === 0) { const { _disableSelfView } = this.props;
if (!this._separateLocalThumbnail && !_disableSelfView && viewableItems[0]?.index === 0) {
// Skip the local thumbnail. // Skip the local thumbnail.
viewableItems.shift(); viewableItems.shift();
} }
@ -189,7 +191,7 @@ class Filmstrip extends PureComponent<Props> {
let startIndex = viewableItems[0].index; let startIndex = viewableItems[0].index;
let endIndex = viewableItems[viewableItems.length - 1].index; let endIndex = viewableItems[viewableItems.length - 1].index;
if (!this._separateLocalThumbnail) { if (!this._separateLocalThumbnail && !_disableSelfView) {
// We are off by one in the remote participants array. // We are off by one in the remote participants array.
startIndex -= 1; startIndex -= 1;
endIndex -= 1; endIndex -= 1;

View File

@ -152,7 +152,9 @@ class TileView extends PureComponent<Props> {
* @returns {void} * @returns {void}
*/ */
_onViewableItemsChanged({ viewableItems = [] }: { viewableItems: Array<Object> }) { _onViewableItemsChanged({ viewableItems = [] }: { viewableItems: Array<Object> }) {
if (viewableItems[0]?.index === 0) { const { _disableSelfView } = this.props;
if (viewableItems[0]?.index === 0 && !_disableSelfView) {
// Skip the local thumbnail. // Skip the local thumbnail.
viewableItems.shift(); viewableItems.shift();
} }
@ -163,8 +165,8 @@ class TileView extends PureComponent<Props> {
} }
// We are off by one in the remote participants array. // We are off by one in the remote participants array.
const startIndex = viewableItems[0].index - 1; const startIndex = viewableItems[0].index - (_disableSelfView ? 0 : 1);
const endIndex = viewableItems[viewableItems.length - 1].index - 1; const endIndex = viewableItems[viewableItems.length - 1].index - (_disableSelfView ? 0 : 1);
this.props.dispatch(setVisibleRemoteParticipants(startIndex, endIndex)); this.props.dispatch(setVisibleRemoteParticipants(startIndex, endIndex));
} }

View File

@ -249,11 +249,11 @@ class Filmstrip extends PureComponent <Props> {
* @returns {Object} * @returns {Object}
*/ */
_calculateIndices(startIndex, stopIndex) { _calculateIndices(startIndex, stopIndex) {
const { _currentLayout, _iAmRecorder, _thumbnailsReordered } = this.props; const { _currentLayout, _iAmRecorder, _thumbnailsReordered, _disableSelfView } = this.props;
let start = startIndex; let start = startIndex;
let stop = stopIndex; let stop = stopIndex;
if (_thumbnailsReordered) { if (_thumbnailsReordered && !_disableSelfView) {
// In tile view, the indices needs to be offset by 1 because the first thumbnail is that of the local // In tile view, the indices needs to be offset by 1 because the first thumbnail is that of the local
// endpoint. The remote participants start from index 1. // endpoint. The remote participants start from index 1.
if (!_iAmRecorder && _currentLayout === LAYOUTS.TILE_VIEW) { if (!_iAmRecorder && _currentLayout === LAYOUTS.TILE_VIEW) {