Search code examples
javascriptaudiomute

Mute Audio from Javascript?


I was sitting here wondering if it's possible to write a greasemonkey script that would detect sites like payperclick and mute the audio so the ad isn't heard.

I realize that I could accomplish the same thing in a better fashion by simply removing the ad text through a greasemonkey script but for purposes of curiousity, I wondered if you can disable the audio through javascript.


Solution

  • The only way I can see this being possible is if:

    1)the ad has its own "mute button" which called a javascript function...in which case you could just call that function yourself.

    2) The plugin the ad is using for audio has a javascript API (same as 1)

    3) IE only: some bizarre IE ActiveX thing that could probably do it...by accessing stuff that it probably shouldn't.

    All of these I consider extremely doubtful

    Any other possibility would be too low level for javascript to have access to (or at least I seriously hope that is the case). A browser by itself has no volume controls....all multimedia are done by plugins.