码迷,mamicode.com
首页 > Web开发 > 详细

播放M3U8的js代码

时间:2019-10-19 13:14:13      阅读:595      评论:0      收藏:0      [点我收藏+]

标签:ESS   list   ext   tran   tac   player   scree   media   char   

<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<!-- Or if you want a more recent canary version -->
<!-- <script src="https://cdn.jsdelivr.net/npm/hls.js@canary"></script> -->
<video id="video"></video>
<script>
  var video = document.getElementById(video);
  if(Hls.isSupported()) {
    var hls = new Hls();
    hls.loadSource(https://路径/index.m3u8);
    hls.attachMedia(video);
    hls.on(Hls.Events.MANIFEST_PARSED,function() {
      video.play();
  });
 } else if (video.canPlayType(application/vnd.apple.mpegurl)) {
    video.src = https://路径/index.m3u8;
    video.addEventListener(loadedmetadata,function() {
      video.play();
    });
  }
</script>

ckplayer播放器播放M3U8视频

 

<div id="a1"></div>
<script type="text/javascript" src="/ckplayer/ckplayer.js" charset="utf-8"></script>
<script type="text/javascript">
    var flashvars={
        f:m3u8.swf,
        a:http://ztest.qiniudn.com/sintel.m3u8,
        s:4,
        c:0
};
    var params={bgcolor:#FFF,allowFullScreen:true,allowScriptAccess:always,wmode:transparent};
    var video=[http://ztest.qiniudn.com/sintel.m3u8];
    CKobject.embed(/ckplayer/ckplayer.swf,a1,ckplayer_a1,100%,100%,false,flashvars,video,params);
</script>

 

播放M3U8的js代码

标签:ESS   list   ext   tran   tac   player   scree   media   char   

原文地址:https://www.cnblogs.com/ComputerVip/p/11703333.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!