1
0
mirror of https://github.com/shimunn/aria2xspf.git synced 2023-11-17 09:27:54 +01:00

script to persist playback position

This commit is contained in:
shimunn 2019-04-26 15:27:54 +02:00
parent 2a253fcea1
commit 824dedae00
2 changed files with 25 additions and 0 deletions

3
aria2xspf.toml Normal file
View File

@ -0,0 +1,3 @@
[include]
js = ["https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.0/jquery.min.js", "https://raw.githubusercontent.com/shimunn/aria2xspf/include/js/resume.js"]
css = []

22
js/resume.js Normal file
View File

@ -0,0 +1,22 @@
(function($, window) {
$(window).on('load', function() {
$("video").each(function(e) {
var src = this.currentSrc;
console.log(src);
var start = window.localStorage[btoa(src)];
if (start) {
this.currentTime = parseFloat(start);
}
});
});
setInterval(function() {
$("video").each(function(e) {
var src = this.currentSrc;
var time = this.currentTime;
if (time) {
window.localStorage[btoa(src)] = time;
console.log("Persisted video progress at: " + time);
}
});
}, 5000);
}($, window));