目前尝试用chplayer可以正常播放
- 下载 sdk到网站js目录
- 发布文章时,内容demo
<script type="text/javascript" src="view/js/chplayer/chplayer.js"></script>
<div id="video1" style="width:600px;height:400px;"></div>
<script type="text/javascript">
var videoObject = {
container: '#video1',//“#”代表容器的ID,“.”或“”代表容器的class
variable: 'player',//该属性必需设置,值等于下面的new chplayer()的对象'
poster: 'https://t.niutula.com/upload/vod/2020-04-01/15857173300.jpg', //封面
autoplay: false,//自动播放
html5m3u8:true,
video:'https://s6.niuniu-baidu.com/2020/04/01/l2uKHazfox7gch1L/index.m3u8'
};
var player=new chplayer(videoObject);
</script>
注意事项
- 去掉播放器水印"chplayer",修改chplayer.js文件
//全局变量/变量类型:String/功能:定义logo
logo: '我是Logo',
- u3m8自动播放bug,修改chpalyer.js
if(!this.isM3u8) {
html = '<video id="' + vid + '"' + src + ' width="100%" height="100%"' + autoplay + poster + loop + ' webkit-playsinline="true">' + source + track + '</video>';
} else {
html = '<video id="' + vid + '" width="100%" height="100%"' + autoplay + poster + loop + ' webkit-playsinline="true">' + track + '</video>';
}
来源:oschina
链接:https://my.oschina.net/u/2351685/blog/3216568