100ms Logo

100ms

Docs

Search docs
/

Mute / Unmute

An user should be able to mute or un-mute both audio & video as per their choice. 100ms SDK makes it simple to do just that in nifty way.

  1. First, get the reference to local peer using the convenience method localPeer on HMSSDK class
  2. Next, get the audio or video track of the local peer
  3. Now, set it's mute status to true or false.
  • When mute is true, local peer won't transmit any audio or video. 🤫🤐
  • When mute is false, local peer can speak & show the world whatever they want to. 🕺💃

Mute Audio 🙊

hmsSDK.localPeer?.localAudioTrack()?.setMute(true)

Ummute Audio 🐵

hmsSDK.localPeer?.localAudioTrack()?.setMute(false)

Mute Video 🙈

hmsSDK.localPeer?.localVideoTrack()?.setMute(true)

Unmute Video 🐒

hmsSDK.localPeer?.localVideoTrack()?.setMute(false)

Note: Ensure that you call these functions from the main queue.