[pitivi] mediafilespreviewer: Fix replay not doing anything



commit 03ae63f0a49e97ffb77c701f8b071debcf6b92d4
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sun May 29 01:32:21 2016 +0200

    mediafilespreviewer: Fix replay not doing anything
    
    Double click an asset, let it play to the end, press play, notice it
    does nothing. Now it plays from the start.
    
    Before the seeker bar was being moved to the start when EOS, not
    anymore.
    
    Differential Revision: https://phabricator.freedesktop.org/D1023

 pitivi/mediafilespreviewer.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/mediafilespreviewer.py b/pitivi/mediafilespreviewer.py
index 4776222..8d8be94 100644
--- a/pitivi/mediafilespreviewer.py
+++ b/pitivi/mediafilespreviewer.py
@@ -94,6 +94,7 @@ class PreviewWidget(Gtk.Grid, Loggable):
 
         # some global variables for preview handling
         self.is_playing = False
+        self.at_eos = False
         self.original_dims = (PREVIEW_WIDTH, PREVIEW_HEIGHT)
         self.countinuous_seek = False
         self.slider_being_used = False
@@ -285,6 +286,10 @@ class PreviewWidget(Gtk.Grid, Loggable):
         if not self.current_preview_type:
             self.play_on_discover = True
             return
+        if self.at_eos:
+            # The content played once already and the pipeline is at the end.
+            self.at_eos = False
+            self.player.simple_seek(0)
         self.player.setState(Gst.State.PLAYING)
         self.is_playing = True
         self.play_button.set_stock_id(Gtk.STOCK_MEDIA_PAUSE)
@@ -329,6 +334,7 @@ class PreviewWidget(Gtk.Grid, Loggable):
             self.countinuous_seek = False
             value = int(widget.get_value())
             self.player.simple_seek(value)
+            self.at_eos = False
             if self.is_playing:
                 self.player.setState(Gst.State.PLAYING)
             # Now, allow gobject timeout to continue updating the slider pos:
@@ -338,10 +344,14 @@ class PreviewWidget(Gtk.Grid, Loggable):
         if self.countinuous_seek:
             value = int(widget.get_value())
             self.player.simple_seek(value)
+            self.at_eos = False
 
     def _pipelineEosCb(self, unused_pipeline):
+        self._update_position()
         self.pause()
-        self.pos_adj.set_value(0)
+        # The pipeline is at the end. Leave it like that so the last frame
+        # is displayed.
+        self.at_eos = True
 
     def _pipelineErrorCb(self, unused_pipeline, unused_message, unused_detail):
         self.pause(state=Gst.State.NULL)


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