100ms Logo

100ms

Docs

Search docs
/

Mute / Unmute

Mute is something that applies to both audio and video.

When you mute audio, you can't be heard by other people.

When you mute video, you will not be broadcasting your video to other people.

It can be called on local (you) or remote (other people) peer's audio or video tracks.

You get a reference to your own local peer from getLocalPeer on HMSSDK.

You can do the same for remote peers and HMSRemoteVideoTrack and HMSRemoteAudioTrack. Get other peers by calling hmsSDK.getRemotePeers()

💡 You may get null for any track if the peer was not allowed to publish the track according to its role permissions.

hmsSDK.switchAudio(true); hmsSDK.switchVideo(true); hmsSDK.switchCamera(); hmsSDK.stopCapturing(); hmsSDK.startCapturing();

Setting video and mic off while joining

If you want to join room with audio and video off. you can follow this In onJoin you can call switchAudio and switchVideo.if you want both audio and video to be off while joining.

HMSSDK hmssdk = new HMSSDK(); void onJoin({required HMSRoom room}) async { this.isLocalPeerVideoOn = false; this.isLocalPeerMicOn = false; hmssdk.switchAudio(isOn: true); hmssdk.switchVideo(isOn: true); }