Better requests, code needs cleaning

This commit is contained in:
2020-10-04 23:03:38 +02:00
parent 65c8e5935b
commit 72b0e8775c
4 changed files with 107 additions and 37 deletions
+15 -13
View File
@@ -19,22 +19,24 @@
var lastId, player;
app.ports.registerVideo.subscribe(function(args) {
var time = parseInt(args[2], 10) || undefined;
if (app.ports !== undefined && app.ports.registerVideo !== undefined) {
app.ports.registerVideo.subscribe(function(args) {
var time = parseInt(args[2], 10) || undefined;
requestAnimationFrame(function() {
if (args[0] !== lastId) {
lastId = args[0];
requestAnimationFrame(function() {
if (args[0] !== lastId) {
lastId = args[0];
player = vd.setup(args[0], {
v: args[1] + "/manifest.mpd",
t: parseInt(args[2], 10) || 0
});
} else if (time !== undefined ){
player.currentTime(time);
}
player = vd.setup(args[0], {
v: args[1] + "/manifest.mpd",
t: parseInt(args[2], 10) || 0
});
} else if (time !== undefined ){
player.currentTime(time);
}
});
});
});
}
</script>
</body>
</html>