hlsPlayback.js 476 B

123456789101112131415
  1. function playVideo(overlay) {
  2. const video = overlay.parentElement.querySelector('video');
  3. video.setAttribute("controls", "");
  4. overlay.style.display = "none";
  5. const url = video.getAttribute("data-url");
  6. var hls = new Hls({autoStartLoad: false});
  7. hls.loadSource(url);
  8. hls.attachMedia(video);
  9. hls.on(Hls.Events.MANIFEST_PARSED, function () {
  10. hls.loadLevel = hls.levels.length - 1;
  11. hls.startLoad();
  12. video.play();
  13. });
  14. }