GTK 3 Gstreamer sink widget not accessible via pygobject
The .widget
property of a Gstreamer sink made with pygobject does not exist, which prevents creating an embedded video widget in GTK 3.
#! /usr/bin/python3
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gst', '1.0')
from gi.repository import Gtk, Gst
Gtk.init()
Gst.init()
#gtksink = Gst.ElementFactory.make("gtksink", None)
gtksink = Gst.ElementFactory.make("gtkglsink", None)
help(gtksink) # lists 'widget' as a property
print(dir(gtksink)) # no 'widget' property
widget = gtksink.widget
AttributeError: 'GstGtkGLSink' object has no attribute 'widget'
A similar program for GJS does seem to provide the .widget
property, although its attributes may be hidden:
#! /usr/bin/gjs
'use strict';
imports.gi.versions.Gtk = "3.0";
const Gtk = imports.gi.Gtk;
const Gst = imports.gi.Gst;
Gtk.init(null)
Gst.init(null)
//let gtksink = Gst.ElementFactory.make("gtksink", null);
let gtksink = Gst.ElementFactory.make("gtkglsink", null);
console.log(gtksink);
console.log(gtksink.widget);
console.log(gtksink.invalid_attr);
Gjs-Console-Message: 16:09:55.333: {}
Gjs-Console-Message: 16:09:55.336: {}
Gjs-Console-Message: 16:09:55.336: undefined
I tested similar Python code in Flatpak with the org.gnome.Platform
runtime version 43, and Fedora 37, with the amd64 architecture, and I ran into this issue in both.
Thanks for your help! : )