Skip to content

Instantly share code, notes, and snippets.

@drewp
Last active December 18, 2015 07:29
Show Gist options
  • Select an option

  • Save drewp/5747220 to your computer and use it in GitHub Desktop.

Select an option

Save drewp/5747220 to your computer and use it in GitHub Desktop.
player never prints any lines about messages
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