Table of Contents
onGotMuted()
wrtc.onGotMuted() is an event function called when when person you were in call with mutes or unmutes its mic or cam or requests you to mute your own mic or cam.
Usually when a client mutes its camera a black image is transmitted. To be able to have a nicer user experience you can use this event to display something else instead.
Remote muting is carried out automatically by wrtc_kit - but for unmute you need to write your own code.
Arguments
wrtc.onGotMuted(obj, channel, muted)
- obj - call object raising the event
- channel - string:
- "audio": remote client muted/unmuted its mic
- "video": remote client muted/unmuted its cam
- "mic": remote client muted your mic
- "cam": remote client muted your cam
- muted - boolean, true if channel was muted (stopped transmitting), false if channel was unmuted (started transmitting again)
For channel mic and cam muted=true will automatically mute your cam or mic by wrtc_kit. But if muted=false is received wrtc_kit does not unmute (for privacy reasons). You need to write your own code.
Return value
Ignored.
Example
wrtc.onGotMuted(obj, "audio", true) - remote microphone was muted
wrtc.onGotMuted(obj, "video", true) - remote camera was muted
wrtc.onGotMuted(obj, "audio", false) - remote microphone transmits audio again
wrtc.onGotMuted(obj, "video", false) - remote camera transmits video again
wrtc.onGotMuted(obj, "mic", true) - your microphone has become muted by call partner
wrtc.onGotMuted(obj, "cam", true) - your camera has become muted by call partner
wrtc.onGotMuted(obj, "mic", false) - call partner asks you to unmute your mic - you need to implement your own code doing it
wrtc.onGotMuted(obj, "cam", false) - call partner asks you to unmute your cam - you need to implement your own code doing it
wrtc_kit automatically mutes your mic/cam if muted=true is received. It does however not unmute them upon received muted=false to avoid privacy issues. You can do it in wrtc.onGotMuted() instead:
wrtc.onGotMuted(obj, channel, muted) {
if ((channel == "mic") && (muted === false))
... ask user if she allows microphone to be turned on again, then ...
wrtc.MuteMic(false);
}
See Also
call.is("receivingVideo") returns false if remote camera is muted.