Skip to content

Instantly share code, notes, and snippets.

@kimberleehowley
Last active March 19, 2021 23:07
Show Gist options
  • Save kimberleehowley/540a78ebb9e3c3aed5cacabea0d47567 to your computer and use it in GitHub Desktop.
Save kimberleehowley/540a78ebb9e3c3aed5cacabea0d47567 to your computer and use it in GitHub Desktop.
Map over call state to determine how many tiles to display
// In callState.js
function getCallItems(participants) {
let callItems = { ...initialCallState.callItems }; // Ensure we *always* have a local participant
for (const [id, participant] of Object.entries(participants)) {
callItems[id] = {
videoTrackState: participant.tracks.video,
audioTrackState: participant.tracks.audio,
};
if (shouldIncludeScreenCallItem(participant)) {
callItems[id + '-screen'] = {
videoTrackState: participant.tracks.screenVideo,
audioTrackState: participant.tracks.screenAudio,
};
}
}
return callItems;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment