在这记录腾讯云超级播放器的使用及播放器的占位图的方法,废话不多说,请看代码
1.引用js
<script src="https://cloudcache.tencent-cloud.com/open/qcloud/video/vcplayer/TcPlayer-2.3.3.js" charset="utf-8"></script>
<script src="http://***.video.js?flv=https://***.flv&m3u8=https://***.m3u8" id="testjs" charset="utf-8"></script>
第一个外部js为腾讯云超级播放器的引用地址,大家可以去腾讯云去引用最新的js
第二个为占位图的显示js文件,在我的资源中可以下载,js的目录需要带上直播的地址,第一个为flv的流地址,第二个为m3u8的流地址,位置不能搞错。id也需要加上
2.html中写
<div style="position: relative;">
<div id="NothingVideo" style="width: 100%;height: 100%;position: absolute;top: 0;z-index: 9;display: none;">
<img src="无直播时显示的占位图" style="width:100%" alt="" />
</div>
<div id="id_test_video" style="width:100%; height:auto;"></div>
</div>
效果介绍:无直播的时候会显示占位图图片内容,当然也可以将占位图替换成别的东西,但是必须是id为NothingVideo的div中。当有直播的时候,占位图会消失,并且自动播放改直播。有什么疑问,大家可以在下面留言,请多多指教!!!