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:
parent
2a253fcea1
commit
824dedae00
3
aria2xspf.toml
Normal file
3
aria2xspf.toml
Normal 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
22
js/resume.js
Normal 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));
|
Loading…
x
Reference in New Issue
Block a user