NOMO.asia

setMuted function

According to the link below, twitch player inserted by javascript can be muted with the setMuted() function.

https://dev.twitch.tv/docs/embed/video-and-clips#synchronous-volume-controls



setMuted(false) works fine to unmute.

However, setMuted(true) does not work to mute.


setVolume(0.0) can be used instead of setMuted(true), but the volume is not recovered when player is unmuted.

Of course, before the player is muted using setVolume(0.0), the volume can be stored in a variable.

But it is not clear.




Functions that can be used instead of setMuted(true)

player can be muted by following function instead of setMuted(true).


player._sendCommand("setMuted", [true]);


I tested it on Chrome 71.0.3578.98 and it worked.

_sendCommand is a function in the https://player.twitch.tv/js/embed/v1.js file that you load to use embed twitch.

So, you do not need to write _sendCommand function.




Why setMuted(true) does not work

Below are some of the contents of https://player.twitch.tv/js/embed/v1.js 



_sendCommand function requires an eventName and a parameter as input variables.



But only when using the setMuted function, input variables are not passed exactly.

I do not know why this part is written in this way.