imports.gi.versions.GLib = '2.0'; imports.gi.versions.GObject = '2.0'; imports.gi.versions.Gio = '2.0'; imports.gi.versions.Gdk = '3.0'; imports.gi.versions.Gtk = '3.0'; imports.gi.versions.Clutter = '1.0'; imports.gi.versions.Gst = '0.10'; imports.gi.versions.GstBase = '0.10'; imports.gi.versions.GstVideo = '0.10'; const Mainloop = imports.mainloop; const IcecastClient = imports.icecastClient; const Panel = imports.panel; const GLib = imports.gi.GLib; const GObject = imports.gi.GObject; const Gio = imports.gi.Gio; const Gdk = imports.gi.Gdk; const Gtk = imports.gi.Gtk; const Clutter = imports.gi.Clutter; const Mx = imports.gi.Mx; const Gst = imports.gi.Gst; const ClutterGst = imports.gi.ClutterGst; let application = null; let style = null; let stage = null; let stageLayout = null; _init(); function _initApplication() { Gtk.init(null, null); let settings = Gtk.Settings.get_default(); settings.gtk_application_prefer_dark_theme = true; application = new Gtk.Application({ application_id: 'org.gnome.LiveMeetFeed' }); } function _initGStreamer() { Gst.init(null, null); Gst.debug_set_active(true); Gst.debug_set_default_threshold(Gst.DebugLevel.WARNING); Gst.debug_set_colored(false); } function _initStyle() { style = Mx.Style.get_default(); style.load_from_file('default.css'); } function _initStage() { Clutter.init(null, null); stage = Clutter.Stage.get_default(); stage.set_size(512, 512); stage.set_user_resizable(true); stage.connect('delete-event', function() { Mainloop.quit(''); return true; }); stage.set_title("Live Meet Feed"); stageLayout = new Mx.BoxLayout({ name: 'stage-layout', orientation: Mx.Orientation.VERTICAL }); stage.add_actor(stageLayout); stageLayout.add_constraint(new Clutter.BindConstraint({ source: stage, coordinate: Clutter.BindCoordinate.SIZE })); stageLayout.add_constraint(new Clutter.BindConstraint({ source: stage, coordinate: Clutter.BindCoordinate.POSITION })); } function _init() { _initApplication(); _initGStreamer(); _initStyle(); _initStage(); let pipeline = Gst.Pipeline.new('feed-pipeline'); let texture = new Clutter.Texture({ name: 'video-texture' }); stageLayout.add_actor(texture, -1); stageLayout.child_set_expand(texture, true); stageLayout.child_set_y_fill(texture, true); stageLayout.child_set_y_align(texture, 0.0); texture.show(); let source = Gst.ElementFactory.make('camerabin', 'camera-source'); pipeline.add(source); let sink = new ClutterGst.VideoSink({ texture: texture }); source.viewfinder_sink = sink; pipeline.set_state(Gst.State.PLAYING); let panel = new Panel.Panel(); stageLayout.add_actor(panel.actor, -1); stageLayout.child_set_expand(panel.actor, false); stageLayout.child_set_x_align(panel.actor, 0.0); stageLayout.child_set_x_fill(panel.actor, true); stageLayout.child_set_y_align(panel.actor, 1.0); stageLayout.child_set_y_fill(panel.actor, false); panel.connect('toggle-fullscreen', function () { stage.set_fullscreen(!stage.get_fullscreen()); }); stage.show_all(); Mainloop.run(''); }