Skip to main content
Version: 1.x.x

Mute All Participants - React

When hosting a meeting, it's essential for the host to have the capability to mute all the participants at once. This can be useful in various scenarios, such as when the host wants to deliver a presentation or when there is background noise causing distractions. This guide focuses on this very aspect of muting all other participants' microphone.

  • To achieve this, iterate over the list of all participants from the useMeeting hook and call the disableMic method from the useParticipant hook.
note

This page uses the following asynchronous methods. Refer to their API reference for the errors each Promise may reject with, and handle these rejections appropriately based on your use case.

import { useMeeting } from "@videosdk.live/react-sdk";

const { participants } = useMeeting();

async function handleMuteAllParticipant() {
[...participants.values()].forEach((participant) => {
if (!participant.isLocal) {
try {
await participant.disableMic();
} catch (err) {
console.error("disableMic failed:", err);
}
}
});
}

return (
<>
<button onClick={handleMuteAllParticipant}>Mute All</button>
</>
);
note

The Participant with the capability to mute all other participants' microphones, should have permission allow_mod passed in the token. To know more about permissions visit here.

API Reference

The API references for all the methods and events utilized in this guide are provided below.

Got a Question? Ask us on discord


Was this helpful?