I have developed an application where the user can set videos on a web page: - They can specify a Youtube URL OR - They can upload a video
Depending on which option
[upgraded to answer per request]
Autoplay on most mobile platforms (Android, iOS) gets blocked to avoid poor user experiences - video should only play following a user action. You can usually work around it by triggering the play() on another event (eg the onloaded event)
Auto-play is disabled since Android SDK 17, but you can set setMediaPlaybackRequiresUserGesture to false to re-enable auto-play. Don't forget to check the SDK version because there is not such function in earlier versions.
int SDK_INT = android.os.Build.VERSION.SDK_INT;
if (SDK_INT > 16) {
engine.getSettings().setMediaPlaybackRequiresUserGesture(false);
}
For Android 4.0.x, try triggering the event : loadstart
var vid=document.getElementById('video');
vid.addEventListener("loadstart", showVideo, false);
function showVideo(e) {
vid.play();
}
That can not be achieved, autoplay on most mobile platforms (Android, iOS) gets blocked to avoid poor user experiences. Look at this: http://www.longtailvideo.com/html5/autoloop/