# Mute/unmute microphone or webcam programmatically

**URL:** <https://devforum.zoom.us/t/mute-unmute-microphone-or-webcam-programmatically/18704>\
**Category:** Web\
**Created:** [May 22, 2020, 8:49am UTC](https://devforum.zoom.us/t/mute-unmute-microphone-or-webcam-programmatically/18704 "2020-05-22T08:49:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pavel.lychkousky](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pavel.lychkousky/32/9026_2.png) [@pavel.lychkousky](https://devforum.zoom.us/u/pavel.lychkousky)\
**Post date:** [May 22, 2020, 8:49am UTC](https://devforum.zoom.us/t/mute-unmute-microphone-or-webcam-programmatically/18704/1 "2020-05-22T08:49:48Z")

</div>

Hi!  
How to mute/unmute microphone or webcam using Web SDK for anonymous participant programmatically? (Get current user returns undefined for anonymous participant).

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [May 27, 2020, 10:46pm UTC](https://devforum.zoom.us/t/mute-unmute-microphone-or-webcam-programmatically/18704/2 "2020-05-27T22:46:14Z")

</div>

Hey @pavel.lychkousky,

What do you mean `anonymous participant`?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![pavel.lychkousky](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pavel.lychkousky/32/9026_2.png) [@pavel.lychkousky](https://devforum.zoom.us/u/pavel.lychkousky)\
**Post date:** [May 29, 2020, 7:23am UTC](https://devforum.zoom.us/t/mute-unmute-microphone-or-webcam-programmatically/18704/3 "2020-05-29T07:23:37Z")

</div>

Without zoom account (or not logged in)

---

<div class="post-metadata">

**Author:** ![pavel.lychkousky](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pavel.lychkousky/32/9026_2.png) [@pavel.lychkousky](https://devforum.zoom.us/u/pavel.lychkousky)\
**Post date:** [June 1, 2020, 1:20pm UTC](https://devforum.zoom.us/t/mute-unmute-microphone-or-webcam-programmatically/18704/4 "2020-06-01T13:20:23Z")

</div>

@tommy Do you need more clarifying?

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [June 5, 2020, 12:17am UTC](https://devforum.zoom.us/t/mute-unmute-microphone-or-webcam-programmatically/18704/5 "2020-06-05T00:17:39Z")

</div>

Hey @pavel.lychkousky,

The user will still have an ID which you can get from the [getCurrentUser](https://zoom.github.io/sample-app-web/ZoomMtg.html#getCurrentUser) function and then use to [mute](https://zoom.github.io/sample-app-web/ZoomMtg.html#mute) the user.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![pavel.lychkousky](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pavel.lychkousky/32/9026_2.png) [@pavel.lychkousky](https://devforum.zoom.us/u/pavel.lychkousky)\
**Post date:** [June 5, 2020, 11:20am UTC](https://devforum.zoom.us/t/mute-unmute-microphone-or-webcam-programmatically/18704/6 "2020-06-05T11:20:47Z")

</div>

@tommy thank you, I was able to mute microphone by this code  
ZoomMtg.getCurrentUser({  
success (response) {  
ZoomMtg.mute({userId: response.result.currentUser.userId, mute: true});  
}  
});

But how can I mute video?

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [June 10, 2020, 7:27pm UTC](https://devforum.zoom.us/t/mute-unmute-microphone-or-webcam-programmatically/18704/7 "2020-06-10T19:27:41Z")

</div>

Hey @pavel.lychkousky,

Happy to hear you are successfully able to mute a participant! 🙂

Currently the Web SDK cannot turn on / off the video. A user has to do this themselves.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 9:59pm UTC](https://devforum.zoom.us/t/mute-unmute-microphone-or-webcam-programmatically/18704/8 "2020-08-21T21:59:10Z")

</div>

Closed on August 21, 2020, 9:59pm UTC


