0
点赞
收藏
分享

微信扫一扫

西瓜播放器api的坑 直播设置自动播放

我们先看一下官方DEMO

new HlsPlayer({
id: 'mse',
url: '//sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/hls/xgplayer-demo.m3u8',
isLive: true,
autoplay: true,true,
height: window.innerHeight,
width: window.innerWidth
});

官方教程是让我们通过autoplay: true设置自动播放 所以我代码是这么写的

this.player = new HlsJsPlayer({
id: `mse`,
url: '//sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/hls/xgplayer-demo.m3u8',
isLive: true,
autoplay: true,
playsinline: true,
height: window.innerHeight,
width: window.innerWidth
});

神奇的事情发生了,这个自动播放属性再vue中未生效 ,需要手动点击播放按钮播放。于是我百度 也有别人遇到了这个问题,并提供了​​解决方案​​。

加一个属性  autoplayMuted: true。

坑 坑 坑,文档上根本没有这个属性

长风破浪会有时,直挂云帆济沧海



举报

相关推荐

0 条评论