Here is how I load / play a video file with the new Gtk4 Video component:
self.video = Gtk.Video()
# (...)
stream = Gtk.MediaFile.new_for_file(file)
self.video.set_media_stream(stream)
stream.play()
But how can I know when the video playback reaches the end of the stream? The MediaStream methods seem to be only "stateful", that is, I would have to implement some sort of timeout to check if the stream is closed.
How to connect to this media_stream (or its underlying bus, because I know how to connect to a Gst pipeline bus message::eos
signal) to fire a callback function on the "end of stream" signal?