Guest User

Untitled

a guest
Apr 14th, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 0.95 KB | None | 0 0
  1. using Gtk;
  2. using Gst;
  3.  
  4. public static int main(string[] args)
  5. {
  6.     Gst.init (ref args);
  7.     Gtk.init(ref args);
  8.     var window = new Window();
  9.     var hbox = new Box(Orientation.HORIZONTAL, 3);
  10.     var file_choose = new FileChooserButton("Select media", FileChooserAction.OPEN);
  11.     var play_button = new Button();
  12.     var stop_button = new Button();
  13.  
  14.     dynamic Element playbin = ElementFactory.make ("playbin", "playbin");
  15.    
  16.     play_button.set_label("Play");
  17.     stop_button.set_label("Stop");
  18.     hbox.add(file_choose);
  19.     hbox.add(play_button);
  20.     hbox.add(stop_button);
  21.     window.add(hbox);
  22.     window.title = "Interface Test";
  23.     window.set_default_size (350, 70);
  24.     window.show_all();
  25.  
  26.     play_button.clicked.connect(() =>
  27.     {
  28.         playbin.uri = file_choose.get_uri();
  29.         playbin.set_state (State.PLAYING);
  30.     });
  31.     stop_button.clicked.connect (() => playbin.set_state (State.READY));
  32.     window.destroy.connect (Gtk.main_quit);
  33.     new MainLoop().run();
  34.    
  35.     Gtk.main();
  36.     return 0;
  37. }
Add Comment
Please, Sign In to add comment