[gnome-music/wip/mschraal/player-factor-out-gstreamer: 34/42] player: Fix progressscale with None duration



commit 20aeeec8f3497a3661ce4eff0ea7a5b1fec9621f
Author: Marinus Schraal <mschraal gnome org>
Date:   Fri Feb 9 17:31:35 2018 +0100

    player: Fix progressscale with None duration

 gnomemusic/player.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index b678f0d..cdfe03b 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -675,8 +675,11 @@ class Player(GObject.GObject):
         to a fixed value, short enough to hide irregularities in GLib event
         timing from the user, for updating the songPlaybackTimeLabel.
         """
-        # Don't run until progressScale has been realized
-        if self.progressScale.get_realized() is False:
+        # Don't run until progressScale has been realized and gstreamer
+        # providers a duration.
+        duration = self._player.duration
+        if (self.progressScale.get_realized() is False
+                or duration is None):
             return
 
         # Update self.timeout
@@ -685,7 +688,6 @@ class Player(GObject.GObject):
             Gtk.StateFlags.NORMAL)
         width -= padding.left + padding.right
 
-        duration = self._player.duration
         timeout_period = min(1000 * duration // width, 1000)
 
         if self.timeout:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]