视频播放m3u8格式插件

引入js:

<script src="https://cdn.jsdelivr.net/hls.js/latest/hls.min.js"></script>

<script>

if(Hls.isSupported()) {
var video = document.getElementById('video_'+index+'');    //div的id多个,可是变量
var hls = new Hls();
hls.loadSource(''+result[0].hlsHd+'');    //视频播放路径,可是变量
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
video.play();
});
}

</script>

posted @ 2019-03-01 14:21  岁月尔尔  阅读(1674)  评论(0编辑  收藏  举报