vidi/Timeline.py: move pipeline player initialization to the __init__ method
[vidi-player.git] / vidi / Timeline.py
index 43bb9c9..c1e9698 100755 (executable)
@@ -43,6 +43,10 @@ class Timeline(object):
 
         self.layer = self.timeline.append_layer()
 
+        ges_pipeline = GES.Pipeline()
+        ges_pipeline.set_timeline(self.timeline)
+        self.player = Player(ges_pipeline)
+
     def add_clip(self, clip_path, start_time, duration):
         clip_uri = Gst.filename_to_uri(clip_path)
         asset = GES.UriClipAsset.request_sync(clip_uri)
@@ -51,10 +55,7 @@ class Timeline(object):
 
     def play(self):
         self.timeline.commit()
-
-        ges_pipeline = GES.Pipeline()
-        ges_pipeline.set_timeline(self.timeline)
-        Player(ges_pipeline).play()
+        self.player.play()
 
     def save(self, path):
         uri = Gst.filename_to_uri(path)