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.
hmsActions.setLocalVideoEnabled(false); hmsActions.setLocalAudioEnabled(true);
Toggling current mute state
- Get current state
- Invert the state and set as new value
function toggleAudio() { const enabled = hmsStore.getState(selectIsLocalAudioEnabled); hmsActions.setLocalAudioEnabled(!enabled); } function toggleVideo() { const enabled = hmsStore.getState(selectIsLocalVideoEnabled); hmsActions.setLocalVideoEnabled(!enabled); }