html5 video 支持 m3u8格式如何实现?

admin HTML/CSS/JS评论594字数 420阅读模式
  1. <script src="https://cdn.jsdelivr.net/hls.js/latest/hls.min.js"></script>  
  2. <video id="video"></video>  
  3. <script>  
  4.   if(Hls.isSupported()) {  
  5.     var video = document.getElementById('video');  
  6.     var hls = new Hls();  
  7.     hls.loadSource('http://www.streambox.fr/playlists/test_001/stream.m3u8');  
  8.     hls.attachMedia(video);  
  9.     hls.on(Hls.Events.MANIFEST_PARSED,function() {  
  10.       video.play();  
  11.   });  
  12.  }  
  13. </script>  

版权声明:文章图片资源来源于网络,如有侵权,请留言删除!!!
admin
  • 本文由 发表于 2021年9月25日 19:06:47
  • 转载请务必保留本文链接:https://www.58pxe.com/7686.html
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: