I am trying to automatically play a video when a user opens a page in a browser. On my laptop, autorun works in all browsers, but on Android it does not work in Google Chrome, and on Iphone it does not work in safari. I have already done a search and google chrome in android does not support the html5 video tag, so I used javascript, but it does not work either. What for? What should I do? Here is my code
<video id="video" autoplay autobuffer controls="controls" allowFullScreen >
<source src="video.mp4" type="video/mp4">
<source src="video.webm" type="video/webm" webView.mediaPlaybackRequiresUserAction = NO;>
<source src="video.theora.ogv" type="video/ogg">
<source src="video.flv" type="video/flv">
<source src="video.vob" type="video/vob">
<source src="video.mov" type="video/mov">
</video>
<script type="text/javascript">
var video = document.getElementById('video'); video.addEventListener('video',function(){
video.play();
});
video.addEventListener("domready", function(){ video.play();
});
video.addEventListener("ended", function(){
window.location = "http://www.google.com"
});
</script>
source
share