Skip to content

Instantly share code, notes, and snippets.

@ZeeAgency
Created June 24, 2011 07:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZeeAgency/1044377 to your computer and use it in GitHub Desktop.
Save ZeeAgency/1044377 to your computer and use it in GitHub Desktop.
HTML5 Volume Control Detection Modernizr Plugin
// Apple decided to not give control of <audio> & <video> volume...
Modernizr.addTest('volume', function() {
// Tested Element
var test = document.createElement('audio');
test.volume = 0.5;
return Modernizr.audio && test.volume === 0.5;
});
@redoPop
Copy link

redoPop commented Apr 26, 2013

Warning on this: on Android this test will seem to have passed even though changing the volume has no actual effect on the video / audio being played. It's currently impossible to detect Android's lack of support for the HTML5 volume API; volumechange events are even fired as though the volume had actually changed.

Oh, it makes me mad, it does! Here's the related Android bug report on Google Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment