ericksonsce
ericksonsce

Reputation: 27

HTML5 Video Controls (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 icon ".sound" to mute or unmute the html5 video ".intro-movie" when clicked.

Upvotes: 0

Views: 5328

Answers (1)

Darron Park
Darron Park

Reputation: 11

I tried may examples, and I finally made it myself. It works perfectly.

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)";
}

}

Upvotes: 1

Related Questions