Skip to content

Instantly share code, notes, and snippets.

@kimberleehowley
Last active March 19, 2021 23:33
Show Gist options
  • Save kimberleehowley/1c1f5860cea67cdaaecd021bd2a0c721 to your computer and use it in GitHub Desktop.
Save kimberleehowley/1c1f5860cea67cdaaecd021bd2a0c721 to your computer and use it in GitHub Desktop.
Loop over call state and pass participant audio tracks to individual tile components
function getTiles() {
let largeTiles = [];
let smallTiles = [];
Object.entries(callState.callItems).forEach(([id, callItem]) => {
const isLarge =
isScreenShare(id) ||
(!isLocal(id) && !containsScreenShare(callState.callItems));
const tile = (
<Tile
key={id}
videoTrackState={callItem.videoTrackState}
audioTrackState={callItem.audioTrackState}
isLocalPerson={isLocal(id)}
isLarge={isLarge}
disableCornerMessage={isScreenShare(id)}
onClick={
isLocal(id)
? null
: () => {
sendHello(id);
}
}
/>
);
if (isLarge) {
largeTiles.push(tile);
} else {
smallTiles.push(tile);
}
});
return [largeTiles, smallTiles];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment