Skip to content

Instantly share code, notes, and snippets.

@yusufusta
Created December 15, 2019 08:30
Show Gist options
  • Save yusufusta/517477b298fda85091729554d31d3af3 to your computer and use it in GitHub Desktop.
Save yusufusta/517477b298fda85091729554d31d3af3 to your computer and use it in GitHub Desktop.
Plyr + hls.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HLS Demo</title>
<link rel="stylesheet" href="https://cdn.plyr.io/1.8.2/plyr.css">
</head>
<body>
<video preload="none" id="player" autoplay controls crossorigin></video>
<script src="https://cdn.plyr.io/1.8.2/plyr.js"></script>
<script src="https://cdn.jsdelivr.net/hls.js/latest/hls.js"></script>
</body>
</html>
(function () {
var video = document.querySelector('#player');
if (Hls.isSupported()) {
var hls = new Hls();
hls.loadSource('https://content.jwplatform.com/manifests/vM7nH0Kl.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
video.play();
});
}
plyr.setup(video);
})();
body {
max-width: 1024px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment