Created
April 1, 2012 17:03
-
-
Save bwesterb/2277083 to your computer and use it in GitHub Desktop.
Failing gapless playback with pygst
This file contains 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 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