diff --git a/data/com.github.rafostar.Clapper.gschema.xml b/data/com.github.rafostar.Clapper.gschema.xml
index f0789201..93c3e91a 100644
--- a/data/com.github.rafostar.Clapper.gschema.xml
+++ b/data/com.github.rafostar.Clapper.gschema.xml
@@ -32,6 +32,14 @@
"second"
Unit to use with seeking value
+
+ true
+ Ask to resume unfinished video
+
+
+ '[]'
+ Data storing unfinished videos resume info
+
diff --git a/src/player.js b/src/player.js
index f6092ea0..36da0d8c 100644
--- a/src/player.js
+++ b/src/player.js
@@ -372,6 +372,18 @@ class ClapperPlayer extends PlayerBase
if(size[0] > 0 && size[1] > 0)
clapperWidget._saveWindowSize(size);
}
+ if(this.state !== GstClapper.ClapperState.STOPPED) {
+ let resumeInfo = {};
+ if(settings.get_boolean('resume-enabled')) {
+ resumeInfo.title = this.playlistWidget.getActiveFilename();
+ resumeInfo.time = Math.floor(this.position / 1000000000);
+ resumeInfo.duration = this.duration / 1000000000;
+
+ debug(`saving resume info for: ${resumeInfo.title}`);
+ debug(`resume time: ${resumeInfo.time}, duration: ${resumeInfo.duration}`);
+ }
+ settings.set_string('resume-database', JSON.stringify([resumeInfo]));
+ }
settings.set_double('volume-last', this.volume);
clapperWidget.controls._onCloseRequest();