Skip to content

Commit

Permalink
Only show GstSink when playback has started, closes Cimbali#222
Browse files Browse the repository at this point in the history
  • Loading branch information
Cimbali committed Nov 4, 2021
1 parent ce57d08 commit 910a331
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
4 changes: 3 additions & 1 deletion pympress/media_overlays/gst_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, *args, **kwargs):
self.media_overlay.remove(self.movie_zone)
self.media_overlay.pack_start(self.sink.props.widget, True, True, 0)
self.media_overlay.reorder_child(self.sink.props.widget, 0)
self.sink.props.widget.show()
self.sink.props.widget.hide()

# Create bus to get events from GStreamer playin
bus = self.playbin.get_bus()
Expand Down Expand Up @@ -101,6 +101,7 @@ def on_play(self, *args):
"""
GLib.idle_add(self.do_update_duration)
GLib.timeout_add(200, self.do_update_time)
self.sink.props.widget.show()


def do_update_duration(self, *args):
Expand Down Expand Up @@ -150,6 +151,7 @@ def do_stop(self):
"""
self.playbin.set_state(Gst.State.NULL)
self.playbin.set_state(Gst.State.READY)
self.sink.props.widget.hide()

return False

Expand Down
28 changes: 15 additions & 13 deletions pympress/share/xml/media_overlay.glade
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,6 @@
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<signal name="map" handler="handle_embed" swapped="no"/>
<child>
<object class="GtkDrawingArea" id="movie_zone">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
<signal name="button-press-event" handler="play_pause" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="toolbar">
<property name="visible">True</property>
Expand Down Expand Up @@ -99,6 +86,21 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack-type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkDrawingArea" id="movie_zone">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
<signal name="button-press-event" handler="play_pause" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
Expand Down

0 comments on commit 910a331

Please sign in to comment.