Created
December 15, 2019 08:30
-
-
Save yusufusta/517477b298fda85091729554d31d3af3 to your computer and use it in GitHub Desktop.
Plyr + hls.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
max-width: 1024px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment