I don't like this way of doing record position

This commit is contained in:
Thomas Forgione 2021-03-24 08:18:46 +01:00
parent c28f3ef9ae
commit 28f6c05acb
1 changed files with 1 additions and 11 deletions

View File

@ -23,8 +23,7 @@
if (app.ports !== undefined && app.ports.registerVideo !== undefined) {
app.ports.registerVideo.subscribe(function(args) {
window.scrollTo(0, 0);
var time = vd.parseTime(args[2]);
time = time || vd.parseTime(localStorage.getItem(args[0]));
var time = vd.parseTime(args[2]) || undefined;
requestAnimationFrame(function() {
if (args[0] !== lastId) {
@ -39,8 +38,6 @@
player.currentTime(time);
}
});
setTimeout(recordPosition, 1000);
});
}
@ -50,13 +47,6 @@
lastId = undefined;
});
}
function recordPosition() {
if (lastId !== undefined) {
localStorage.setItem(lastId, player.currentTime());
setTimeout(recordPosition, 1000);
}
}
</script>
</body>
</html>