Hls.js demo - basic usage





<body>
  <!-- https://hls-js.netlify.app/demo/basic-usage.html -->
  <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
  <!-- <script src="https://hls-js.netlify.app/dist/hls.js"></script> -->

  <center>
    <h1>Hls.js demo - basic usage</h1>
    <!-- controls is true or false -->
    <video height="600" id="video-player" controls></video>
  </center>

  <script>
    var video = document.getElementById('video-player');
    var videoSrc = 'https://video.twimg.com/amplify_video/1511540044250566660/pl/tKANSitLrcY2zUh-.m3u8?variant_version=1&tag=14&container=fmp4';
    //
    // First check for native browser HLS support
    //
    if (video.canPlayType('application/vnd.apple.mpegurl')) {
    video.src = videoSrc;
    video.play();
    //
    // If no native HLS support, check if HLS.js is supported
    //
    } else if (Hls.isSupported()) {
      var hls = new Hls();
      hls.loadSource(videoSrc);
      hls.attachMedia(video);
      hls.on(Hls.Events.MEDIA_ATTACHED, function () {
        video.muted = true;
        video.play();
      });
    }
  </script>

</body>




14:00:50

Posted by 피코
,