Skip to content

Instantly share code, notes, and snippets.

@bwesterb
Created April 1, 2012 17:03
Show Gist options
  • Save bwesterb/2277083 to your computer and use it in GitHub Desktop.
Save bwesterb/2277083 to your computer and use it in GitHub Desktop.
Failing gapless playback with pygst
import pygst
pygst.require("0.10")
import gst
import sys
import gobject
class Player:
def __init__(self, filename):
self.filename = filename
self.player = gst.element_factory_make("playbin2", "player")
self.player.set_property("uri", filename)
self.player.connect("about-to-finish", self.on_about_to_finish)
def run(self):
self.player.set_state(gst.STATE_PLAYING)
loop = gobject.MainLoop()
loop.run()
def on_about_to_finish(self, player):
print 'about-to-finish'
player.set_property("uri", self.filename)
if __name__ == "__main__":
gobject.threads_init()
player = Player("file:///usr/share/gnome-games/sounds/gnometris.ogg")
player.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment