HTML5 video control (mute button)

$(".sound").click(function() { if ($(".intro-movie").prop('muted', true)) { $(".intro-movie").prop('muted', true); $(".sound").addClass("muted"); } else { $(".intro-movie").prop('muted', false); $(".sound").removeClass("muted"); } }); 

Trying to get the sound ".sound" icon to mute or enable html5 ".intro-movie" sound when clicked.

0
source share
1 answer

I tried to give examples, and I finally did it myself. It works great.

 function mute() { if(myaudio.muted) { myaudio.muted=!myaudio.muted; document.getElementById("volume").style.backgroundImage = "url(resources/vol.png)"; }else{ myaudio.muted=!myaudio.muted; document.getElementById("volume").style.backgroundImage = "url(resources/mute.png)"; } 

}

+1
source

All Articles