admin管理员组

文章数量:1287591

Is there a way to programmatic-ally control audio level on tabs i want to regardless of how web app was designed (be it HTML5 Audio element or Flash, etc.)?

Just to make it clear i don't intend to research web page for some "id" "elements" or whatsoever, but something like Chrome.ThisAudioOutputLevels...?

Is there a way to programmatic-ally control audio level on tabs i want to regardless of how web app was designed (be it HTML5 Audio element or Flash, etc.)?

Just to make it clear i don't intend to research web page for some "id" "elements" or whatsoever, but something like Chrome.ThisAudioOutputLevels...?

Share Improve this question asked Jul 26, 2015 at 17:16 user963720user963720
Add a ment  | 

2 Answers 2

Reset to default 8

Admitting that the audio es from a <audio> HTML element, you can try to get all audio elements from the DOM and lower their volumes. I was suffering from this with google hangouts meetings where I couldn't lower the audio because it had no control whatsoever.

"The solution"

I selected all <audio> elements and lowered their volumes. Follow these steps:

  1. Open your console on the given tab. (Press F12).
  2. Select all audio elements.
  3. Lower each audio volume.
let audios = [...document.getElementsByTagName('audio')];
audios.forEach(audio => audio.volume = 0.5) // lower volume 50%.

Volume range = {0..1} where 0 = no volume.

This is more of a ment than an answer, but I can't ment, so:

Browsers generally try not to change how the content is meant to be displayed, including sound. For this reason, I would be surprised if there were such a feature.

If you're trying to simply mute tabs, you could take a look at chrome://flags/#enable-tab-audio-muting

Alternatively you could use tampermonkey or a similar extension and run a search for all audio/video tags and change the volume, but you said you didn't want to search for specific elements. To my knowledge (and Google's) as of right now there is no volume control for an entire page.

本文标签: Javascript control Google Chrome39s open tab audio volume controlStack Overflow