if (this.isWechat) {
if (window['WeixinJSBridge']) {
window['WeixinJSBridge'].invoke('getNetworkType', {}, (e) => {
this.doPlay()
})
} else {
document.addEventListener("WeixinJSBridgeReady", function(){
window['WeixinJSBridge'].invoke('getNetworkType', {}, (e) => {
this.doPlay()
})
}, false);
}
} else {
this.doPlay();
}
doPlay() {
const domList = Array.from(document.querySelectorAll('video'));
if (domList.length) {
domList.forEach(video => {
console.log(video);
video.currentTime = 0;
video.muted = true;
video.autoplay = true;
video.loop = true;
video.setAttribute('webkit-playsinline', 'true');
video.setAttribute('x5-video-player-fullscreen', 'true');
video.setAttribute('x5-playsinline', 'true');
video.setAttribute('playsinline', 'true');
console.log(video.play());
video.play();
});
}
}
微信浏览器自动播放
最新推荐文章于 2024-06-21 16:41:46 发布