Created
February 17, 2016 05:13
-
-
Save cnbeining/e1060b69329db8939471 to your computer and use it in GitHub Desktop.
HLS.js Sample page
This file contains 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 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