Skip to main content
Version: 3.x.x

Mute All Participants - Android

A host or moderator can mute every participant at once, for example before a presentation or when background noise distracts the room.

  • Loop over room.participants and call disableMic() on each Participant.
  • disableMic() is a suspend function, so call it from a coroutine. It throws a VideoSDKException if the server refuses the request.
  • room.participants changes as people join and leave, so iterate over a copy of it.
  • Skip AI agents: on an agent, disableMic() always throws UnsupportedOperationException.
btnMuteAllParticipant!!.setOnClickListener { _: View? ->
lifecycleScope.launch {
for (participant in room.participants.values.toList()) {
if (participant.isAgent()) continue
try {
participant.disableMic()
} catch (e: VideoSDKException) {
Log.d("VideoSDK", "Could not mute ${participant.displayName}: ${e.code} ${e.message}")
}
}
}
}
note

The participant who mutes other participants must have the allow_mod permission in their 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


Was this helpful?

Not helpfulHelpful