From 48a3a3530af3af1edbb00ab4ccc65df6ff2b9a73 Mon Sep 17 00:00:00 2001 From: Matthew Clark Date: Tue, 20 Mar 2018 07:43:36 +0000 Subject: [PATCH] Tidy up and first python example --- python_examples/playbin.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 python_examples/playbin.py diff --git a/python_examples/playbin.py b/python_examples/playbin.py new file mode 100644 index 0000000..bfeae66 --- /dev/null +++ b/python_examples/playbin.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# +# Make sure the environment variable SRC is set to a playable file +# e.g. +# export SRC='/tmp/me.mp4' +# + +import gi +gi.require_version('Gst', '1.0') +from gi.repository import GObject, Gst +import os + +Gst.init() +mainloop = GObject.MainLoop() + +pl = Gst.ElementFactory.make("playbin", "player") +pl.set_property('uri','file://'+os.environ['SRC']) + +#running the playbin +pl.set_state(Gst.State.PLAYING) +mainloop.run()