GstChildProxy needs the same getter/setter override as GObject.Object
Some Gst elements, such as webrtcbin, are implemented as GstChildProxy as opposed to an instantiation of their actual class.
GstChildProxy doesn't go through the same overridden getter/setters as GObject.Object, meaning that it's impossible to get or set properties correctly.
This can be monkey patched by transferring over getProperty/setProperty from GObject.Object.prototype, and that fixes my immediate use case, but I get the feeling there's more to it than that that i'm not equipped to deal with, hence why i'm raising this as an issue as opposed to a PR :|
Example which illustrates the problem at hand:
const gi = require('node-gtk');
const Gst = gi.require('Gst', '1.0');
const GObject = gi.require('GObject', '1.0');
gi.require('GstWebRTC', '1.0');
gi.require('GstSdp', '1.0');
Gst.init();
gi.startLoop();
const webrtcbin = Gst.parseLaunch('webrtcbin bundle-policy=3');
console.log(webrtcbin.getProperty('bundle-policy')); // Logs an invalid GValue and an assertion error
webrtcbin.getProperty = GObject.Object.prototype.getProperty;
console.log(webrtcbin.getProperty('bundle-policy')); // Logs 3
I am not quite sure whether this solves your problem but you could use JS properties instead:
// this should work
console.log(webrtcbin.bundlePolicy)
Of course it is not trivial to get the right naming of the properties here if you are used to do these things in other languages.
Huh, TIL. That's handy to know, thanks. Did I miss that in the documentation?
(I would also argue it's worth patching up get/set property regardless so node-gtk has parity with other language bindings, ie: "I know that I do get_property in python, so I assume it's getProperty here)
I think you can find it in the documentation in the section about the naming convention where it says that properties have lowerCamelCase style. But it is really not obvious that this helps here.
I do not see a simple way to patch this particular version of getProperty as you would need access to GstChildProxy somehow (if I understand correctly). Maybe this issue is somehow related to what we did in #206.
Sorry for the delay, haven't looked at the issue yet but it will go in the next batch of changes I make (when I can find time). Not sure what GstChildProxy is but I don't see a reason why we couldn't find it somewhere. If it's a GObject, it should have the getProperty method, but it might be overriden by someone if it's not returning the correct value.
No worries, the workaround helped me get going anyway.
From what I understand, this is an interface which is implemented by GstBin which allows for implementing classes to add property getters/setters that proxy through to a child contained within that bin, hence child proxy :)