2
votes

I have a problem with video autostart in android browser(or in boat browser). It was worked and is working on android <4.2.2 version perfectly. But on android versions higher than 4.2.2 it can't get video to autostart, instead waiting for mouse click to play. Below is shown the basic part of my code.

<script>
var vid=document.getElementById('videoPlayer');
vid.addEventListener("loadstart", showVideo, false);

function showVideo() {
  vid.play();
}
</script>
<video id="videoPlayer" src="videos/video1.mp4" width="100%" height="auto" autoplay="autoplay" autobuffer controls />

How to autostart mp4 video on android browser when android version >=4.4 ?

1
developer.android.com/reference/android/webkit/… WebView.getSettings().setMediaPlaybackRequiresUserGesture(false) - JohnWick
How I know WebView not acting in browser. I want to autoplay my video into a browser. - Harutyun Dermenjyan
Also I have added the WebView.getSettings().setMediaPlaybackRequiresUserGesture(false) // in my javascript code but it did not help. - Harutyun Dermenjyan
Can you adjust my code above please ? - Harutyun Dermenjyan
OK, but anyway how can I force to autoplay? Is there a variant to force autoplay? - Harutyun Dermenjyan

1 Answers

0
votes

Android does not allow autoplay in mobile web, you have to allow autoplay when constructing the WebView in your native code, or route from a user event to the invocation of the player.play()

iOS can only play fullscreen in mobile web, if you want inline video it has to be in-app