As of today, JW.org has content in 908 languages! You can check out the latest statistics yourself below:
After my previous post about getting more volume with the Web Audio API , I decided to look into controlling the loudness of audio tags and video tags in a more straight-forward (prototypal) way. That’s when I came up with the following JS prototype:
The following are all of the methods associated with each instance:
Returns a reference to the associated
Returns a reference to the associated source node.
Returns a reference to the associated gain node.
Returns a reference to the media element that was passed in to instantiate the
Returns the volume. If
true-ish, the returned value will be the volume multiplied by the loudness.
Sets the volume to the specified value. If
value is greater than
1, the loudness will be modified accordingly and the real volume will be set to
Returns how much gain is used for the audio of the instance’s media element.
Sets the gain used for the audio of the instance’s media element.
Returns how many decibels the audio of the instance’s media element will be playing at.
Sets how many decibels the audio of the instance’s media element will be playing at.
Returns a number indicating how loud the audio of the instance’s media element is playing compared to normal.
1 is normal.
Sets a value indicating how loud the audio of the instance’s media element will be playing.
How To Use It
Here is an example of how this can be used in the wild:
In addition to what is done in this simple example you can use the other instance functions to get and set the different values associated with the gain value and the volume.
I was able to come up with this solution thanks to the following page:
Happy coding! 😎