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:
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));
|
Reference in New Issue
Block a user