Mute All Participants - React Native
The host can mute all 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
useRoomhook and call thedisableMicmethod on each of them. The list also contains the local participant, so skip it by comparing withlocalParticipant.id.
import { useRoom } from "@videosdk.live/react-native-sdk";
import { TouchableOpacity, Text } from "react-native";
function MuteAllButton() {
const { participants, localParticipant } = useRoom();
async function handleMuteAllParticipant() {
for (const participant of participants.values()) {
if (participant.id !== localParticipant.id) {
try {
await participant.disableMic();
} catch (err) {
console.error("disableMic failed:", err);
}
}
}
}
return (
<>
<TouchableOpacity
onPress={() => {
handleMuteAllParticipant();
}}
>
<Text>Mute All</Text>
</TouchableOpacity>
</>
);
}
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.
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 utilised in this guide are provided below.
Got a Question? Ask us on discord

