From 8fb6b971fe4e374356f7d1059b161dc3880be1ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Fri, 9 Apr 2021 13:53:43 +0200 Subject: [PATCH] Always try to update end time after new media info --- src/revealers.js | 2 +- src/widget.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/revealers.js b/src/revealers.js index 46e16092..d6eb8bac 100644 --- a/src/revealers.js +++ b/src/revealers.js @@ -162,7 +162,7 @@ class ClapperRevealerTop extends CustomRevealer /* Make sure that next timeout is always run after clock changes, * by delaying it for additional few milliseconds */ - const nextUpdate = 60002 - parseInt(currTime.get_seconds() * 1000); + const nextUpdate = 60004 - parseInt(currTime.get_seconds() * 1000); debug(`updated current time: ${now}, ends at: ${end}`); return nextUpdate; diff --git a/src/widget.js b/src/widget.js index 8458f5a0..de24d6cf 100644 --- a/src/widget.js +++ b/src/widget.js @@ -203,6 +203,9 @@ class ClapperWidget extends Gtk.Grid this.isSeekable = mediaInfo.is_seekable(); this.controls.setLiveMode(isLive, this.isSeekable); + /* Update remaining end time if visible */ + this.updateTime(); + if(this.player.needsTocUpdate) { if(!isLive) this.updateChapters(mediaInfo.get_toc()); @@ -324,11 +327,11 @@ class ClapperWidget extends Gtk.Grid updateTime() { - const revealerTop = this.revealerTop; - if( - !revealerTop.visible - || !revealerTop.revealerGrid.visible + !this.revealerTop.visible + || !this.revealerTop.revealerGrid.visible + || !this.isFullscreenMode + || this.isMobileMonitor ) return null; @@ -458,7 +461,7 @@ class ClapperWidget extends Gtk.Grid } const isNotStopped = (state !== GstClapper.ClapperState.STOPPED); - this.revealerTop.endTime.set_visible(isNotStopped); + this.revealerTop.endTime.visible = isNotStopped; } _onPlayerDurationChanged(player, duration)