update mute all buttons to avoid wildcards
This commit is contained in:
parent
ea458c03eb
commit
11e0a1953f
|
|
@ -101,6 +101,22 @@ export const PeopleAside = () => {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function muteAll(deviceType) {
|
||||||
|
let updatedParticipantList = {};
|
||||||
|
// Accommodate muting mics and cameras
|
||||||
|
const newSetting =
|
||||||
|
deviceType === 'video' ? { setVideo: false } : { setAudio: false };
|
||||||
|
for (let id in callObject.participants()) {
|
||||||
|
// Do not update the local participant's device (aka the instructor)
|
||||||
|
if (id === 'local') continue;
|
||||||
|
|
||||||
|
updatedParticipantList[id] = newSetting;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update all participants at once
|
||||||
|
callObject.updateParticipants(updatedParticipantList);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Aside onClose={() => setShowAside(false)}>
|
<Aside onClose={() => setShowAside(false)}>
|
||||||
<AsideHeader />
|
<AsideHeader />
|
||||||
|
|
@ -111,9 +127,7 @@ export const PeopleAside = () => {
|
||||||
fullWidth
|
fullWidth
|
||||||
size="tiny"
|
size="tiny"
|
||||||
variant="outline-gray"
|
variant="outline-gray"
|
||||||
onClick={() =>
|
onClick={() => muteAll('audio')}
|
||||||
callObject.updateParticipants({ '*': { setAudio: false } })
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
Mute all mics
|
Mute all mics
|
||||||
</Button>
|
</Button>
|
||||||
|
|
@ -121,9 +135,7 @@ export const PeopleAside = () => {
|
||||||
fullWidth
|
fullWidth
|
||||||
size="tiny"
|
size="tiny"
|
||||||
variant="outline-gray"
|
variant="outline-gray"
|
||||||
onClick={() =>
|
onClick={() => muteAll('video')}
|
||||||
callObject.updateParticipants({ '*': { setVideo: false } })
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
Mute all cams
|
Mute all cams
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue