How do I best detect whether a browser's HTML5 video element supports autoplay?
On current iOS Safari, for example, autoplay is disabled.
Update: I now designed the web page in such a way that it works irrespective of whether autoplay is supported. Now when the page is loaded an initialization video is shown. On an iPad, the user is presented with a big play button. Once playback has been triggered, the video is hidden. Afterwards, playback of the video player can be controlled from JavaScript, which is what I actually need.
Definition and Usage The autoplay attribute is a boolean attribute. When present, the audio/video will automatically start playing as soon as it can do so without stopping.
The simplest way to automatically play content is to add the autoplay attribute to your <audio> or <video> element.
The HTML autoplay Attribute is used to specify that the audio/video should automatically start playing when web page is loaded. It is a Boolean attribute.
A little late to the party, but the accepted solution seems outdated: Modernizr now has implemented this feature, see https://github.com/Modernizr/Modernizr/blob/master/feature-detects/video/autoplay.js
Contains similar hacks to the other solutions posted here though, but as long as browsers don't expose availabilty of this feature, this seems to be the best solution for now.
Note that this an async test available since Modernizr 3, so you have to use the following .on()
syntax for your test:
Modernizr.on('videoautoplay', function(result){ if(result) { alert('video autoplay is supported'); } else { alert('video autplay is NOT supported'); } });
See for yourself: http://codepen.io/anon/pen/VYoWWY?editors=001
The above sample includes Modernizr 3 with the 'videoautplay' feature detection (http://v3.modernizr.com/download/#-videoautoplay).
Maybe this will help future googlers like myself - this function creates/removes a video and tests to see if it can autoplay. It then sets a global variable "autoplay" to true or false. It tests for MP4 and webM compatibility, but adding more wouldn't be difficult if need be (just base 64 encode and append another source). The "acceptable delay" variable is how long it should reasonably take the device to start playing the test videos. With a combination of limited bandwidth/processing sometimes it makes sense to use the fallback (non autoplay) solution, even if autoplay is supported. I usually use 100ms.
function detect_autoplay(acceptable_delay){ autoplay = false; var autoplay_test_content = document.createElement('video'); //create mp4 and webm sources, 5s long var mp4 = document.createElement('source'); mp4.src = "data:video/mp4;base64,AAAAFGZ0eXBNU05WAAACAE1TTlYAAAOUbW9vdgAAAGxtdmhkAAAAAM9ghv7PYIb+AAACWAAACu8AAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAA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8YIUzLuNs4ID6LeH94EB8YIUzLuNs4IFNbeH94EB8YIUzLuNs4IGg7eH94EB8YIUzLuNs4IH0LeH94EB8YIUzLuNs4IJHbeH94EB8YIUzLuNs4IKa7eH94EB8YIUzLuNs4ILuLeH94EB8YIUzLuNs4INBbeH94EB8YIUzLuNs4IOU7eH94EB8YIUzLuNs4IPoLeH94EB8YIUzLuNs4IQ7beH94EB8YIUzLuNs4ISO7eH94EB8YIUzBFNm3SPTbuMU6uEH0O2dVOsghTM"; //append sources to test video autoplay_test_content.appendChild(webm); autoplay_test_content.appendChild(mp4); //set attributes -needs to be visible or IE squawks, so we move it way outside autoplay_test_content.id = "base64_test_video"; autoplay_test_content.autoplay = true; autoplay_test_content.style.position = "fixed"; autoplay_test_content.style.left = "5000px"; //add to DOM document.getElementsByTagName("body")[0].appendChild(autoplay_test_content); var base64_test_video = document.getElementById("base64_test_video"); //test for autoplay, 100 ms buffer setTimeout(function(){ if(!base64_test_video.paused){ autoplay = true; } document.getElementsByTagName("body")[0].removeChild(autoplay_test_content); },acceptable_delay); } detect_autoplay(100);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With