Detecting Microphone State with Web SDK

Description
I’m looking for a way to determine when a meeting attendee has muted or unmuted their microphone. The closest I have seen so far is that there’s a “muted” property on the JSON object that’s passed when an attendee joins the meeting. Once the meeting is in progress, I’m not seeing the events for when the microphone changes its muted state.

I’d rather not do some sort of ugly hack on the DOM to track the visuals of the icons. It seems like the web control is listening to “something” in order to change the icon states, but that it just isn’t exposed to developers through the SDK.

Which version?
1.8.5

Hey @frank.hoffman,

Thank you for reaching out to the Zoom Developer Forum. If you want to check if a user is muted, you can use the GetCurrentUser() function and reference the muted field returned.

We have an example of how to use this function in our Sample Web App:

Let me know if that helps.

Thanks,
Max

Wouldn’t I have to implement a polling solution in that scenario though? I worry a bit about chattiness. If I poll too often, I’d also worry about being throttled or overextending our license. Are these valid concerns?

Hey @frank.hoffman,

Thank you for your question. Instead of polling if a user is muted or not, you can also add an event listener to the mute/unmute button and only call the getCurrentUser() function when the button is clicked. This logic would be placed within the success callback of the join() function.

I’m not sure if this would work for your use-case and you would want to account for other events such as when you place them on mute but it should reduce the number of times that you have to make this call:

const btn = document.querySelector('button.join-audio-container__btn');

if (btn !== null) {
    btn.addEventListener('click', () => {
        ZoomMtg.getCurrentUser({
            success(r) {
                console.log('success getCurrentUser', r.result.currentUser);
            },
        });
    });
}

This does seem like a good feature to have built-in though. If you would like this feature to be considered for a future release, I recommend posting in the #feature-requests category.

Let me know if that helps.

Thanks,
Max

Thank you for helping me figure this out. It’s actually a really interesting use case. I have an existing app that’s used to control 98 individual physical microphones via Crestron. I’m now needing to support a hybrid environment where some people are remote via Zoom, and others are physically present.

I’m joining the meeting via our microphone application using Zoom in host mode. The app needs to know when the microphone is actually on (which we usually do via a Crestron callback). I also detect when people join and leave the Zoom meeting so I can update their presence in the application.

Since I need to know the state of all 98 microphones, what I’ve done is set up a 1 second timer that calls getAttendeeslist and updates the microphone states for all 98 attendees. I’m a little worried about the chattiness involved so I’ll be working on ways to reduce the chatter. I will submit the feature request. I will also see what can be done via the DOM as you suggested. Thank you!

Hey @frank.hoffman,

I’m glad to hear that was helpful! That definitely is an interesting use-case. I think the best solution here would be to add a ZoomMtg.inMeetingServiceListener for onUserAudioStatusChange similar to our Windows SDK.

If you submit a feature request for this, feel free to send me the link and I’ll forward it to our engineering team.

Thanks,
Max

Here is a link to my feature request: Microphone State Events in Web SDK - Feature Requests - Zoom Developer Forum

1 Like

Thanks @frank.hoffman ! :slight_smile:

We will evaluate this.

-Tommy

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.