Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using My;
- using My.Media;
- using Gtk;
- using Gst;
- using Gst.Video;
- static Window win;
- public static void main(string[] args){
- Gtk.init(ref args);
- Gst.init(ref args);
- Youtube yt = new Youtube("http://www.youtube.com/watch?v=1aUb6mn8IoM");
- if(yt.urls.size <1)return;
- Element e = ElementFactory.make("playbin",null);
- e.set("uri",yt.urls.get(0));
- e.bus.add_watch(0,cb);
- win = new Window();
- win.destroy.connect(Gtk.main_quit);
- win.show_all();
- e.set_state(Gst.State.PLAYING);
- Gtk.main();
- }
- static bool cb(Gst.Bus bus, Gst.Message message){
- if(message.get_structure() == null)return true;
- if(message.get_structure().get_name() == null)return true;
- if(message.get_structure().get_name() == "prepare-window-handle"){
- (message.src as Gst.Video.Overlay).set_window_handle((uint*)Gdk.X11Window.get_xid(win.get_window()));
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement