How to mute an html5 video player using jQuery

Cody picture Cody · Jun 16, 2011 · Viewed 112.9k times · Source

I've found how to pause and play the video using jquery

$("video").get(0).play();
$("video").get(0).pause();

But I can't find the mute button, if there isn't a jquery solution, I'm fine with just an onclick js solution. I need it asap.

Also is there a way to fix the mute delay? I want it to mute/unmute the sound as soon as the button is clicked.

Answer

Naftali aka Neal picture Naftali aka Neal · Jun 16, 2011
$("video").prop('muted', true); //mute

AND

$("video").prop('muted', false); //unmute

See all events here

(side note: use attr if in jQuery < 1.6)