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,