3 # Get a test sample with:
4 # youtube-dl -t http://www.youtube.com/watch?v=yWa-YXiSk2Y
15 def __init__(self, filename):
16 self._filename = filename
18 self._player = gst.element_factory_make("playbin2", "player")
19 self._player.set_property("uri", filename)
20 self._player.connect("about-to-finish", self.on_about_to_finish)
23 self._player.set_state(gst.STATE_PLAYING)
24 loop = gobject.MainLoop()
27 def on_about_to_finish(self, player):
29 player.set_property("uri", self._filename)
34 sys.stdout.write("usage: %s <URI-OF-MEDIA-FILE>\n" % args[0])
40 if not gst.uri_is_valid(args[1]):
41 sys.stderr.write("Error: Invalid URI: %s\n" % args[1])
44 player = Player(args[1])
47 if __name__ == '__main__':
48 sys.exit(main(sys.argv))