Mute All Participants - Python
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
meeting
class and call thedisable_mic
method from theparticipant
class.
Setup
from videosdk import Meeting, MeetingConfig, VideoSDK
import asyncio
VIDEOSDK_TOKEN = "VIDEOSDK_TOKEN"
MEETING_ID = "MEETING_ID"
NAME = "NAME"
loop = asyncio.get_event_loop()
Example
async def mute_all(meeting: Meeting):
for paricipant in meeting.participants.values():
print("Participant Mute Called: ", paricipant.display_name)
paricipant.disable_mic()
async def main():
meeting_config = MeetingConfig(
meeting_id=MEETING_ID,
name=NAME,
mic_enabled=True,
webcam_enabled=True,
token=VIDEOSDK_TOKEN,
)
meeting = VideoSDK.init_meeting(**meeting_config)
# asynchronously join the meeting
await meeting.async_join()
print("Muting all participants")
await mute_all(meeting)
if __name__ == "__main__":
loop.run_until_complete(main())
loop.run_forever()
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