Last active
December 18, 2015 07:29
-
-
Save drewp/5747220 to your computer and use it in GitHub Desktop.
player never prints any lines about messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gi | |
| gi.require_version('Gst', '1.0') | |
| from gi.repository import GObject, Gst | |
| from twisted.internet import gireactor, reactor | |
| def main(): | |
| GObject.threads_init() | |
| Gst.init(None) | |
| pipeline = Gst.ElementFactory.make('playbin',None) | |
| pipeline.set_property("uri", "file:///home/drewp/projects-local/light9/show/dance2013/music/02-daffy.wav") | |
| pipeline.set_state(Gst.State.PLAYING) | |
| def skip(): | |
| pipeline.seek_simple( | |
| Gst.Format.TIME, | |
| Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE | Gst.SeekFlags.SKIP, | |
| 88 * Gst.SECOND) | |
| reactor.callLater(1, skip) | |
| bus = pipeline.get_bus() | |
| bus.add_signal_watch() | |
| def on_any(bus, msg): | |
| print "message %s %s %s" % (bus, msg, msg.type) | |
| bus.connect('message', on_any) | |
| def w(*args): | |
| print "w", args | |
| bus.connect('message::eos', w) | |
| def onStreamStatus(bus, message): | |
| print "streamstatus", bus, message | |
| (statusType, _elem) = message.parse_stream_status() | |
| bus.connect('message::stream-status', onStreamStatus) | |
| reactor.run() | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment