Last active
March 19, 2021 23:33
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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