forked from axiomatic-systems/Bento4
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
6,092 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test/frag.m4s | ||
test/kevs | ||
test/kevs* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<html> | ||
<head> | ||
<title>Hls.js demo - basic usage</title> | ||
</head> | ||
|
||
<body> | ||
<script src="../dist/hls.js"></script> | ||
|
||
<center> | ||
<h1>Hls.js demo - basic usage</h1> | ||
<video height="600" id="video" controls></video> | ||
</center> | ||
|
||
<script> | ||
var video = document.getElementById('video'); | ||
if (Hls.isSupported()) { | ||
var hls = new Hls({ | ||
debug: true, | ||
}); | ||
hls.loadSource('https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8'); | ||
hls.attachMedia(video); | ||
hls.on(Hls.Events.MEDIA_ATTACHED, function () { | ||
video.muted = true; | ||
video.play(); | ||
}); | ||
} | ||
// hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled. | ||
// When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video element through the `src` property. | ||
// This is using the built-in support of the plain video element, without using hls.js. | ||
else if (video.canPlayType('application/vnd.apple.mpegurl')) { | ||
video.src = 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8'; | ||
video.addEventListener('canplay', function () { | ||
video.play(); | ||
}); | ||
} | ||
</script> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title></title> | ||
</head> | ||
<body> | ||
<script src="../dist/hls.js"></script> | ||
<video id="video" controls></video> | ||
<script> | ||
function parseQuery(queryString) { | ||
var query = {}; | ||
var pairs = ( | ||
queryString[0] === '?' ? queryString.slice(1) : queryString | ||
).split('&'); | ||
for (var i = 0; i < pairs.length; i++) { | ||
var pair = pairs[i].split('='); | ||
query[decodeURIComponent(pair[0])] = decodeURIComponent( | ||
pair[1] || '' | ||
); | ||
} | ||
return query; | ||
} | ||
|
||
/* get stream from query string */ | ||
function getParameterByName(name) { | ||
var query = parseQuery(window.location.search); | ||
return query.hasOwnProperty(name) ? query[name] : undefined; | ||
} | ||
|
||
var stream = | ||
getParameterByName('stream') || | ||
'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8'; | ||
</script> | ||
<script> | ||
if (Hls.isSupported()) { | ||
var video = document.getElementById('video'); | ||
var hls = new Hls(); | ||
hls.loadSource(stream); | ||
hls.attachMedia(video); | ||
hls.on(Hls.Events.MEDIA_ATTACHED, function () { | ||
video.muted = true; | ||
video.play(); | ||
}); | ||
} | ||
</script> | ||
<script> | ||
var video = document.getElementById('video'); | ||
window.onload = function () { | ||
var i = 0; | ||
var el = document.getElementById('update'); | ||
function foo() { | ||
i++; | ||
el.innerHTML = | ||
'animation:' + | ||
i + | ||
',decoded:' + | ||
video.webkitDecodedFrameCount + | ||
',dropped:' + | ||
video.webkitDroppedFrameCount; | ||
window.requestAnimationFrame(foo); | ||
} | ||
foo(); | ||
}; | ||
</script> | ||
<div id="update"></div> | ||
</body> | ||
</html> |
Oops, something went wrong.