Loading

Paste #prdis3moz

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