I'd like to make a mute/unmute button in jQuery. I've done some searching on Stackoverflow and this is what I managed to do so far:
$("video").prop('muted', true);
$("#mute-video").click( function (){
if( $("video").prop('muted', true) )
{
$("video").prop('muted', false);
}
else {
$("video").prop('muted', true);
}
});
but for some reason it's only able to unmute, not to mute back.
Any idea what's wrong with the code?
$("video").prop('muted', false);
– Nearsighted