From 28c1daf70914e0f48be8f2a638833193211fe0f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Mon, 12 Apr 2021 22:29:20 +0200 Subject: [PATCH] Save and offer resume only for local files We do not know if the online URI still leads to the same file as before (or if different one leads to previous). Additionally we would also need to check if media is seekable. Disable for now to avoid problems. --- src/player.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/player.js b/src/player.js index a49027a2..010fd942 100644 --- a/src/player.js +++ b/src/player.js @@ -308,21 +308,21 @@ class ClapperPlayer extends PlayerBase } /* If "quitOnStop" is set here it means that we are in middle of autoclosing */ if(this.state !== GstClapper.ClapperState.STOPPED && !this.quitOnStop) { + const playlistItem = this.playlistWidget.getActiveRow(); + let resumeInfo = {}; - if(settings.get_boolean('resume-enabled')) { - const resumeTitle = this.playlistWidget.getActiveFilename(); + if(playlistItem.isLocalFile && settings.get_boolean('resume-enabled')) { const resumeTime = Math.floor(this.position / 1000000000); const resumeDuration = this.duration / 1000000000; - /* Do not save resume info when title is too long (random URI), - * video is very short, just started or almost finished */ + /* Do not save resume info when video is very short, + * just started or almost finished */ if( - resumeTitle.length < 300 - && resumeDuration > 60 + resumeDuration > 60 && resumeTime > 15 && resumeDuration - resumeTime > 20 ) { - resumeInfo.title = resumeTitle; + resumeInfo.title = playlistItem.filename; resumeInfo.time = resumeTime; resumeInfo.duration = resumeDuration;