An attempt to work with elm-video

This commit is contained in:
2021-06-21 11:30:31 +02:00
parent df821e07af
commit 31cc8a1bb9
9 changed files with 61 additions and 641 deletions
+3 -23
View File
@@ -10,7 +10,8 @@
</head>
<body>
<div id="container"></div>
<script src="js/vd.js"></script>
<script src="https://cdn.rawgit.com/video-dev/hls.js/18bb552/dist/hls.min.js"></script>
<script src="js/elm-video.js"></script>
<script src="js/main.js"></script>
<script>
function isDarkMode(e) {
@@ -37,30 +38,9 @@
}
});
var lastId, player;
setupApp(app);
if (app.ports !== undefined) {
if (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.m3u8",
t: time,
focus: true
});
} else if (time !== undefined ){
player.currentTime(time);
}
});
});
}
if (app.ports.setDarkMode !== undefined) {
app.ports.setDarkMode.subscribe(function(arg) {
if (arg === null) {