enableMic / disableMic instead of muteMic / unmuteMic

So I did a test where I had approx 5 people in the same room, each of them turned their mics on spoke something and muted their mic.

Here’s something that we noticed. Even after muting the mic there was a ‘hiss’ that could be heard, it was faint but all the faint hisses from all mics resulted in a pretty noticeable white noise. I know this sounds crazy but yes I verified that the consumers were going on pause properly. I think its some internal codec implementation thing - out of mediasoup scope. Anyways…

I instantly thought of a solution where instead of calling roomClient.muteMic I would call roomClient.disableMic and instead of unmuteMic we called enableMic. It worked and whenever anyone muted the hissing sound went away completely and we had a silent room.

BUT! an issue was noticed. enable / disable works for the first time but if we enable and disable again the audio is not heard on the other end… Even though using STORE.getState() in the console it can be seen that a consumer is added.

I can see offer and answer being sent and received as expected also.

I don’t see why this happens, or why this should, because in the case of video we don’t mute/unmute we enableWebcam or disableWebcam and a consumer is added / removed.


Chrome generates ambient noise when a remote track is paused. You can remove its associated MediaStream from the HTML audio/video element.

This works fine in the online demo.Just run CLIENT.disableMic() and CLIENT.enableMic() in any browser tab. Tested.

I will test it out again and post back.

Thanks :+1:

So yes the problem was with a react update, it does not work fine sometimes. And there’s another issue which I think is a chrome issue. Everytime we do mute/unmute microphone its doing a getUserMedia, and if you to it allot of times on different tabs, there comes a moment when it does not return anything so all the tabs are unable to disable/enable media.


Hey! so I figured that if we pause the local track when the track on the remote pauses it mutes the local track as well and the hiss goes out completely and the experience is much better.

I have raised a PR on mediasoup-demo: https://github.com/versatica/mediasoup-demo/pull/98

1 Like