简体   繁体   English

html5 javascript自动播放不适用于android 4.4

[英]html5 javascript autoplay not working on android 4.4

I have a problem with video autostart in android browser(or in boat browser). 我在android浏览器(或船用浏览器)中自动启动视频时遇到问题。 It was worked and is working on android <4.2.2 version perfectly. 它已经工作,并且可以完美地在android <4.2.2版本上工作。 But on android versions higher than 4.2.2 it can't get video to autostart, instead waiting for mouse click to play. 但是在高于4.2.2的android版本上,它无法使视频自动启动,而是等待鼠标单击播放。 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 ? 当Android版本> = 4.4时,如何在Android浏览器上自动启动mp4视频?

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() Android不允许在移动网络中进行自动播放,在以本机代码构造WebView时必须允许自动播放,或者从用户事件到播放器调用之间进行player.play()

iOS can only play fullscreen in mobile web, if you want inline video it has to be in-app iOS只能在移动网络中全屏播放,如果您想要内嵌视频,则必须在应用内

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM