Loading

Paste #pk66hdc9d

  1. const {GObject, Gtk, Gst} = imports.gi;
  2.  
  3. Gst.init(null)
  4. Gst.init_check(null)
  5.  
  6. var _bin = Gst.parse_bin_from_description('videotestsrc', true);
  7. var pipeline = new Gst.Pipeline();
  8. var factory = pipeline.get_factory();
  9. var gtksink = Gst.ElementFactory.make('gtksink', null);
  10. pipeline.add(_bin);
  11. pipeline.add(gtksink);
  12.  
  13. _bin.link(gtksink);
  14. var w = gtksink.get_property('widget', null);
  15. w.show();
  16. // Start the video
  17. pipeline.set_state(Gst.State.PLAYING);
  18.  
  19.  
  20. var window = new Gtk.ApplicationWindow();
  21.  
  22. var widget = new Gtk.Box({orientation: Gtk.Orientation.HORIZONTAL});
  23. widget.set_size_request(200, 200);
  24. widget.pack_start(w, true, true, 0);
  25.  
  26. window.add(widget)
  27.  
  28. window.show_all()