I'm looking for a way to increase the volume past 100%. I have some videos where the volume in html5 maxed to 100% is kinda low. Is there anything to make the max volume 200% or define the decibel level that 100% is?
Asked
Active
Viewed 2,117 times
2 Answers
4
It is true that you cannot set the actual volume property of a video tag nor an audio tag above 1, but you can use the Web Audio API to the volume to be twice as loud as normal, effectively doubling the volume:
function amplifyMedia(mediaElem, multiplier) {
var context = new (window.AudioContext || window.webkitAudioContext),
result = {
context: context,
source: context.createMediaElementSource(mediaElem),
gain: context.createGain(),
media: mediaElem,
amplify: function(multiplier) { result.gain.gain.value = multiplier; },
getAmpLevel: function() { return result.gain.gain.value; }
};
result.source.connect(result.gain);
result.gain.connect(context.destination);
result.amplify(multiplier);
return result;
}
The function should be pretty easy to use but this page also gives more details: http://cwestblog.com/2017/08/17/html5-getting-more-volume-from-the-web-audio-api/

imxitiz
- 3,920
- 3
- 9
- 33

Chris West
- 885
- 8
- 17
0
A html5 video's volume property can only be set from 0 to 1 (i.e., 0 to 100 percent):
http://www.w3schools.com/tags/av_prop_volume.asp
Setting outside that range will throw an error. For example:
document.getElementsByTagName("video")[0].volume = 2;
results in
Uncaught DOMException: Failed to set the 'volume' property on 'HTMLMediaElement': The volume provided (2) is outside the range [0, 1].

Morifen
- 126
- 1
- 7
-
I understand that part. When I play the video in WMP for example the sound at 50% is nice and clear. When I play it on a web page at the same 50% the audio is hard to hear. At 100% I can hear it but barely. That is with volume on laptop full blast and speakers set full. I was hoping there was a way to define the volume level of 100%. A code for setting decibels for the volume for example. 100% of of 70db is 70. 100% of 80db is 80. – Steve Jan 08 '16 at 04:39