html5 video doesn't play on android without controls
Only video elements with the muted attribute set to true are allowed to autoplay on Android and iOS devices.
The following example would autoplay:
<div id="video_container">
<video poster="" width="500" id="showReelVid" muted autoplay loop preload>
<source src="http://hemlockdevelopment.net/media/showreel_jurgen_reigman.mp4" type="video/mp4">
Your browser does not support HTML5 video :(.
</video>
</div>
https://jsfiddle.net/16j6851z/
If you require audio, have the video play on click (or with other user input) instead:
HTML
<div id="video_container">
<video poster="" width="500" id="showReelVid" loop preload>
<source src="http://hemlockdevelopment.net/media/showreel_jurgen_reigman.mp4" type="video/mp4"> Your browser does not support HTML5 video :(.
</video>
</div>
JS
var showReelVid = document.getElementById("showReelVid");
showReelVid.onclick = function() {
showReelVid.play();
};
https://jsfiddle.net/p8cmv1vc/
HTML5 video element on Android does not play
Try to remove the codecs from the source listings.. It might be that the codecs you're listing are not present on Android, so it's choking.
If you use the src attribute, it'll auto-detect the codec, so it's using something else :)
Mp4 video in html5 video tag not playing in mobile chrome and mobile safari
Very simply there is no support for autoPlay on mobile safari . Please test all android browsers .
I use one trick with buffering (show some popup to force user for initial first click on any tag/document - It is smart to use accept cookies
or term of use
popups):
var ONLYONETIME_EXECUTE = null;
window.addEventListener('load', function(){ // on page load
document.body.addEventListener('touchstart', function(e){
if (ONLYONETIME_EXECUTE == null) {
video.play();
//if you want to prepare more than one video/audios use this trick :
video2.play();
video2.pause();
// now video2 is buffering and you can play it programmability later
// My personal testing was maximum 6 video/audio for android
// and maybe 3 max for iOS using single click or touch.
// Every next click also can prepare more audios/videos.
ONLYONETIME_EXECUTE = 0;
}
}, false)
}, false)
// It is very usually that user touch screen ...
Review :
I dont understand ios html5 politic . They stop supporting javascript console logger (i quest now :from ver 5.1 ios) .Auto play disabled , webrtc ...
They wanna device who works perfect. Auto play can be dangerous on load. In near future i expect activation full html5 support on all mobile devices.
New update :
I found this like positive answer :
Since the release of iOS 10 Apple has allowed muted video autoplay: https://webkit.org/blog/6784/new-video-policies-for-ios/
HTML5 video element on Android
I've just done some experimentation with this, and from what I can tell you need three things:
- You must not use the type attribute when calling the video.
- You must manually call video.play()
- The video must be encoded to some quite strict parameters; using the iPhone setting on Handbrake with the 'Web Optimized' button checked usually does the trick.
Have a look at the demo on this page: http://broken-links.com/tests/video/
This works, AFAIK, in all video-enabled desktop browsers, iPhone and Android.
Here's the markup:
<video id="video" autobuffer height="240" width="360">
<source src="BigBuck.m4v">
<source src="BigBuck.webm" type="video/webm">
<source src="BigBuck.theora.ogv" type="video/ogg">
</video>
And I have this in the JS:
var video = document.getElementById('video');
video.addEventListener('click',function(){
video.play();
},false);
I tested this on a Samsung Galaxy S and it works fine.
HTML5 Video does not play in mobile device
Couple of things to try:
Use absolute URLs in 'Video src' attribute
Some devices may take little extra time to load the video
Change the device and try ( as you said)
Hope this will help.
Related Topics
Partial Invalidation in Custom Android View with Hardware Acceleration
Finish an Activity After a Time Period
Enable C++11 Support on Android
How to Download Xml File from Server and Save It in Sd Card
Android Stream Video from Google Drive
Fragment's Onsaveinstancestate() Is Never Called
Gradle Dsl Method Not Found: 'Implementation()'
Supportmapfragment.Getmap() Returns Null
Ionic2 Background Image Is Resized When Keyboard Is Open
Resources and Layout Direction Rendered Incorrectly Only on Android 8.0 and Above
How Do Popular Apps Authenticate User Requests from Their Mobile App to Their Server
Android - Choose File Button in Webview
How to Reduce Latency in Mediacodec Video/Avc Decoding
Android Webview HTML5 Video Autoplay Not Working on Android 4.0.3
Listview: Textview with Linkmovementmethod Makes List Item Unclickable
How to Tell If My Textview Has Been Ellipsized