From 6dbfb289ebfcfdc8a43cd147bdefa6cab9f0e8bf Mon Sep 17 00:00:00 2001 From: Enrico Schwendig Date: Wed, 21 Jun 2023 14:51:41 +0200 Subject: [PATCH] Local user should never be in the spotlight (#1125) * Local user should never be in spotlight --- src/video-grid/VideoGrid.tsx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/video-grid/VideoGrid.tsx b/src/video-grid/VideoGrid.tsx index 78c2615..d87f58b 100644 --- a/src/video-grid/VideoGrid.tsx +++ b/src/video-grid/VideoGrid.tsx @@ -750,6 +750,7 @@ function reorderTiles(tiles: Tile[], layout: Layout, displayedTile = -1) { const orderedTiles: Tile[] = new Array(tiles.length); tiles.forEach((tile) => (orderedTiles[tile.order] = tile)); + let firstLocalTile: Tile | undefined; orderedTiles.forEach((tile) => { if (tile.focused) { focusedTiles.push(tile); @@ -758,12 +759,28 @@ function reorderTiles(tiles: Tile[], layout: Layout, displayedTile = -1) { } else if (tile.isSpeaker && displayedTile < tile.order) { speakerTiles.push(tile); } else if (tile.hasVideo) { - onlyVideoTiles.push(tile); + if (tile.order === 0 && tile.item.local) { + firstLocalTile = tile; + } else { + onlyVideoTiles.push(tile); + } } else { - otherTiles.push(tile); + if (tile.order === 0 && tile.item.local) { + firstLocalTile = tile; + } else { + otherTiles.push(tile); + } } }); + if (firstLocalTile) { + if (firstLocalTile.hasVideo) { + onlyVideoTiles.push(firstLocalTile); + } else { + otherTiles.push(firstLocalTile); + } + } + [ ...focusedTiles, ...presenterTiles,