安卓手机上,video无法自动播放;
ios下面可以自动播放;
地址:http://h5.myailand.com/20191129/
测试手机型号:华为p30 pro等
代码段:
<video
id="myVideo"
autoplay
src="https://ailian20190225.oss-cn-hangzhou.aliyuncs.com/20191129/fm.mp4"
preload="auto"
x-webkit-airplay="allow"
x5-video-player-type="h5"
x5-video-player-fullscreen="true"
x5-video-orientation="portrait"
playsinline
webkit-playsinline >
</video>
<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
myVideo = document.getElementById("myVideo");
myVideo.play();
document.addEventListener(
"WeixinJSBridgeReady",
function () {
myVideo.play();
},
false
);
document.addEventListener(
"YixinJSBridgeReady",
function () {
myVideo.play();
},
false
);
是正常表现,视频禁止自动播放
问题解决了吗?遇到同样问题,ios 监听WeixinJSBridgeReady 和touch事件可以播放,Android 下不生效
在微信环境下不要指望了,之前做过一些分析,仅供参考。
iOS已经在系统层禁用
https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW1
安卓微信内置浏览器video的坑
https://segmentfault.com/q/1010000004308128
视频H5のVideo标签在微信里的坑和技巧
https://aotu.io/notes/2017/01/11/mobile-video/index.html
video 标签在微信浏览器的问题解决方法
http://www.bijishequ.com/detail/411747
移动端H5视频播放的那些事儿
https://haohuawu.github.io/2017/03/05/h5-video-player/