Skip to content

Instantly share code, notes, and snippets.

@cnbeining
Created February 17, 2016 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cnbeining/e1060b69329db8939471 to your computer and use it in GitHub Desktop.
Save cnbeining/e1060b69329db8939471 to your computer and use it in GitHub Desktop.
HLS.js Sample page
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>UofTHacksLive! - 2016</title>
<script src="hls.js"></script>
</head>
<body>
<div id="player1">
<video id="video-1" autobuffer="true" data-setup="{}" controls>
<p>Your browser does not support html5 video!</p>
</video>
</div>
<p>HLS URL:</p>
<input type="text" id="myText" value="https://dailymotion.github.io/hls.js/dist/hls.js">
<button onclick="myFunction()">Click me</button>
<script>
function myFunction() {
var url = document.getElementById("myText").value;
if(Hls.isSupported()) {
var video = document.getElementById('video-1');
var hls = new Hls({debug:true});
hls.loadSource(url);
hls.attachMedia(video);
video.play();;
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment