据我所知,HTML5视频的Android无法自动播放。由于它代表我的影视作品在设备上,只有当用户点击播放按钮。
I understand that html5 video on android cannot autoplay. As it stands my video works on the device only when the user clicks on the play button.
<video width="640px" height="360px" src="media/video/Moments_of_Everyday_Life.mp4" controls id="video"></video>
<script type="text/javascript">
$(function(){
var video = document.getElementById('video');
video.play();
});
</script>
为什么会这样行不通?什么是点击播放和使用.play的)这个方法(之间的性差异?
Why would this not work? And what is the diference between clicking play and using this method of .play() ?
更新
这适用于我的dekstop,只是没有对Android设备。
This works on my dekstop, just not on the android device..
它不会出于同样的原因浏览器阻止呼叫到的window.open()
,因为工作允许它可以让Web开发人员,颠覆用户preference不自动播放媒体(或打开弹出窗口)。
It wouldn't work for the same reason browsers block calls to window.open()
, because allowing it would allow web developers to subvert user preference not to auto play media (or open popup windows).
点击播放,使用这种方法的区别,正是你所说的话:点击。这些排序的电话被允许在点击事件,但不普遍。
The difference between clicking play and using this method is exactly what you've said: the click. These sort of calls are allowed in click events, but not generally.
上一篇:使用使用java.beans中的类(内部检查,BeanInfo的或的PropertyDescriptor)罐beans、java、PropertyDescriptor、BeanInfo
下一篇:如何结合Membershi preBOOT和Thinktecture.IdentityServer?preBOOT、Membershi、IdentityServer、Thinktecture