Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Renderer : Gst.PlayerVideoRenderer, GLib.Object {
- Gst.Element gtksink;
- construct {
- gtksink = Gst.ElementFactory.make ("gtksink", null);
- }
- public Gtk.Widget widget {
- owned get {
- Gtk.Widget w;
- gtksink.get ("widget", out w);
- return w;
- }
- }
- public Gst.Element create_video_sink (Gst.Player player) {
- return gtksink;
- }
- }
- public static void main (string[] args) {
- Gtk.init (ref args);
- Gst.init (ref args);
- var window = new Gtk.Window();
- var renderer = new Renderer();
- var player = new Gst.Player.full (renderer, null);
- player.pipeline.bus.add_watch (0, (bus, msg) => {
- if (msg.type == Gst.MessageType.TAG) {
- Gst.TagList list;
- msg.parse_tag (out list);
- print ("%s\n\n", list.to_string());
- }
- return true;
- });
- window.add (renderer.widget);
- player.state_changed.connect (state => {
- /* always NULL
- print ("%s\n", player.media_info.get_tags().to_string());
- print ("%s\n", player.current_audio_track.get_tags().to_string());
- print ("%s\n", player.current_video_track.get_tags().to_string());
- */
- });
- player.uri = "https://www.youtube.com/watch?v=Il61bCC4g3w";
- player.play();
- window.show_all();
- Gtk.main();
- }
Add Comment
Please, Sign In to add comment