Seek to start/end with home/end

This commit is contained in:
Jan Hamal Dvořák 2025-03-09 09:49:11 +01:00
parent ed71a3a05c
commit cf529cae28

View file

@ -302,6 +302,20 @@ class MainWindow(Gtk.ApplicationWindow):
self._seek_relative(-60)
return True
elif keyval == Gdk.keyval_from_name("Home"):
self.pipeline.seek_simple(
Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT, 0
)
return True
elif keyval == Gdk.keyval_from_name("End"):
success, duration = self.pipeline.query_duration(Gst.Format.TIME)
if success:
self.pipeline.seek_simple(
Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT, duration - 1
)
return True
elif keyval == Gdk.keyval_from_name("j"):
self._cycle_subtitles()
return True