Mute All Participants - Flutter
If you are the host or moderator of a video conference, you may want to mute all the participants at once. This can be useful in various scenarios, such as when you want to deliver a presentation or when there is background noise that is causing distractions.
- To achieve this, you have to iterate over the list of participants from the
Roomobject and call thedisableMic()method on eachParticipantobject. room.participantsholds the remote participants only, including any AI agents, so skip the agents.disableMic()is not supported on an AI agent.disableMic()returns aFuturethat throws aVideoSDKErrorif the request is refused. Await each call insidetry/catch, so one failure does not stop the others.
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:videosdk/videosdk.dart';
class RoomScreen extends StatefulWidget {
...
}
class _RoomScreenState extends State<RoomScreen> {
late Room _room;
@override
void initState() {
...
}
Future<void> muteAllParticipants() async {
// Copy the list: participants can join or leave while the calls run
for (final participant in _room.participants.values.toList()) {
// Skip AI agents
if (participant.isAgent()) continue;
try {
await participant.disableMic();
} on VideoSDKError catch (e) {
log("Could not mute ${participant.displayName}: ${e.code} ${e.name}");
}
}
}
@override
Widget build(BuildContext context) {
return Column(
children:[
ElevatedButton(
child: Text("Mute all participants"),
onPressed: muteAllParticipants,
),
]
);
}
}
note
Participant who will be muting other participants 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

