最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - chrome extension: how to mute all audio from certain tab - Stack Overflow

programmeradmin1浏览0评论

I have been searching for something in chrome extension reference to find anything that would allow me to manipulate audio level of a tab. Only option that has e to my mind is make script have it go through all elements in page and either remove them or mute them if possible.

But i feel there has to be a way to reroute all audio streams to nothing, like break them from output which is speakers if using audio api of html5...however no avail either with chrome extension apis or web audio api.

Goal: mute all sounds on page (flash, audio element, etc.)

I have been searching for something in chrome extension reference to find anything that would allow me to manipulate audio level of a tab. Only option that has e to my mind is make script have it go through all elements in page and either remove them or mute them if possible.

But i feel there has to be a way to reroute all audio streams to nothing, like break them from output which is speakers if using audio api of html5...however no avail either with chrome extension apis or web audio api.

Goal: mute all sounds on page (flash, audio element, etc.)

Share Improve this question asked Sep 14, 2014 at 16:57 Muhammad UmerMuhammad Umer 18.2k25 gold badges111 silver badges176 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

You cannot do this now, although this will hopefully change in the near-term future.

At the moment, there is nothing in the Chrome APIs, although I did propose a tabaudio API back in February (and am working on a new draft -- as well as an implementation -- right now.)

Can you give me an idea as to what you want this functionality for? (They ask for potential uses when proposing APIs.)

Perhaps the closest that you can do is something similar to what the MuteTab Chrome extension does (written by me, http://www.github./jaredsohn/mutetab), which basically scans the page for object, embed, audio, video, and applet tags and hides them from the page. Unfortunately, this misses web audio. Also, instead of muting, it "stops" it by removing it from the page, which could block the video or game associated with the sound. Alternatively, if you just care about HTML5 video or audio or Flash that has an API (such as YouTube), you could could use JavaScript to pause or mute things.

There's now a Chrome extension allowing to mute websites by URL using blacklist/whitelist approach called "Mute Tabs by URL".

It does require you to allow it to read your 'browsing history', but description swears that it doesn't store your URLs anywhere, and event points to a location of source code, so you can verify it for yourself

发布评论

评论列表(0)

  1. 暂无评论