7

Is there any way to disable all sound on a browser window that may have embedded videos?

I'm not looking for particular solutions such as targeting Youtube with js etc... I need something general that will shut off all sound for that page so if any video plays it has NO sound. Need something that shuts off sound at the page level, not individually addressing each player via js etc...

I'm not aware of anything that could do that but thought I'd ask.

Many thanks if you could point me in the right direction.

PS: I know about How to mute all sound in a page with JS? but it's not what I need.

Community
  • 1
  • 1
Noodle Head
  • 431
  • 3
  • 10
  • 23
  • Did you read that thread? The solution states "But you get the idea, iterate through media, check/store playing status, and mute/unmute" This is NOT what I want to do as I clearly stated in my op. – Noodle Head Apr 15 '14 at 13:25

1 Answers1

2

You necessary have to iterate in all audio/video tag and set volume to 0.

HTML

<div id="mute-button"><img src=""/><div>

JQuery

$('#mute-button').on('click', function(){

    $('audio,video').each(function(){
       $(this).volume = 0.0;
    });

});

Alternatively you can pause source:

$(this).pause();

For other embedded tag (youtube, vimeo..), take a look at this discussion.

Community
  • 1
  • 1
Luca Davanzo
  • 21,000
  • 15
  • 120
  • 146
  • Thank you - will this work for all, so no matter if it's youtube, vimeo etc...? Asking because I'm not in front of my work computer now to test. – Noodle Head Apr 15 '14 at 13:32
  • 3
    Sorry, perhaps I worded my op too vaguely. But I need something universal. I will have no way of knowing where the video will be embedded from. There are many sites out there (metacafe etc) If I start customizing muting for each I'll go mad :) ... hence what I said about not using Js for youtube etc. I want to mute it all at the page level. Is that doable. Or am I understanding your solution wrong? – Noodle Head Apr 15 '14 at 13:38