Created
June 24, 2011 07:23
-
-
Save ZeeAgency/1044377 to your computer and use it in GitHub Desktop.
HTML5 Volume Control Detection Modernizr Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.