Video playback in GTK
Irene Kravets
IreneK at sapling-inc.com
Thu Feb 11 19:54:22 UTC 2021
I am using Wayland/Weston with GTK and trying to write a Python script to display video on the screen. I have a GTK window with a grid and I just add the widget below to the grid. Video is very choppy. It looks much smoother if I play it from Linux command line using gst-launch-1.0.
Here is my code for the widget:
class VideoWidget(Gtk.Frame)
def __init__(self)
super().__init__()
Gst.init(None)
Gst.init_check(None)
self.player = Gst.ElementFactory.make("playbin")
self.connect('realize', self.on_realize)
self.player.set_property("uri", "https://www.radiantmediaplayer.com/media/big-buck-bunny-360p.mp4")
def on_realize(self, widget):
self.gtksink = Gst.ElementFactory.make("gtksink")
self.player.set_property("video-sink", self.gtksink)
self.add(self.gtksink.props.widget)
self.show_all()
self.player.set_state(Gst.State.PLAYING)
I saw mentions of "waylandsink" that can be used instead of "gtksink", but I couldn't figure out how to use it, since I don't know how to get Gtk.Widget from "waylandsink". I can get it to display in its own window, but I need to be able to control where it goes on the screen.
Does anyone have any examples of how to use "waylandsink" with GTK? I don't have XWayland on my box. Any other suggestions on how to make playback less choppy?
Thank you,
Irene.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20210211/0b199a34/attachment.htm>
More information about the wayland-devel
mailing list