简体   繁体   English

html5视频自动播放在iPhone上不起作用

[英]html5 video autoplay doesn't work on iPhone

<video autobuffer controls autoplay>
  <source id="mp4" src="../vid/coolvideo.mp4" type="video/mp4">
</video>

Is there anyway to autoplay a .mp4 video file on page load for iPhone and Android Smart Mobile Devices. 无论如何,iPhone和Android Smart Mobile设备在页面加载时是否会自动播放.mp4视频文件。 The above works great in the browser, but struggles hard on smart mobile. 上面的代码在浏览器中很好用,但是在智能手机上却很难。 Is there any other HTML5 or even If I must JS solutions for iPhone (without loading a bloated third-party resource, ideally). 是否还有其他HTML5甚至我是否必须为iPhone提供JS解决方案(理想情况下无需加载肿的第三方资源)。 Plain javaScript or plain jQuery, HTML5 solutions ideal. 纯Java脚本或纯jQuery,HTML5解决方案的理想选择。

Check this link 检查此链接

which says:" autoplay is disabled to prevent unsolicited cellular download " 其中说:“ 自动播放已禁用,以防止未经请求的手机下载

It works only if you add muted and playsinline attributes 仅当您添加静音和playsinline属性时,它才有效

<video autoplay playsinline muted loop>
    <source src="cover.mp4" type="video/mp4">
    Your browser does not support HTML5 video.
</video>

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

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