54 lines
1.8 KiB
HTML
54 lines
1.8 KiB
HTML
<!doctype HTML>
|
|
<html>
|
|
<head>
|
|
<title>twitch.tforgione.fr</title>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="icon" type="image/ico" href="/favicon.ico"/>
|
|
<link href="css/video-js.css" rel="stylesheet">
|
|
<link href="css/spinner.css" rel="stylesheet">
|
|
</head>
|
|
<body>
|
|
<div id="container"></div>
|
|
<script src="js/vd.js"></script>
|
|
<script src="js/main.js"></script>
|
|
<script>
|
|
var app = Elm.Main.init({
|
|
node: document.getElementById('container'),
|
|
flags: { width: window.innerWidth, height: window.innerHeight }
|
|
});
|
|
|
|
var lastId, player;
|
|
|
|
if (app.ports !== undefined && app.ports.registerVideo !== undefined) {
|
|
app.ports.registerVideo.subscribe(function(args) {
|
|
window.scrollTo(0, 0);
|
|
var time = vd.parseTime(args[2]) || undefined;
|
|
|
|
requestAnimationFrame(function() {
|
|
if (args[0] !== lastId) {
|
|
lastId = args[0];
|
|
|
|
player = vd.setup(args[0], {
|
|
v: args[1] + "/manifest.mpd",
|
|
t: time,
|
|
focus: true
|
|
});
|
|
} else if (time !== undefined ){
|
|
player.currentTime(time);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
if (app.ports !== undefined && app.ports.eraseVideo !== undefined) {
|
|
app.ports.eraseVideo.subscribe(function() {
|
|
window.scrollTo(0, 0);
|
|
lastId = undefined;
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|