import gst, gtk

player = gst.element_factory_make("playbin2", "player")

bus = player.get_bus()
bus.add_signal_watch()

def start():
	print "playing"
	player.set_property("uri", "http://kevinmehall.net/p/pithos/testfile2.m4a")
	player.set_state(gst.STATE_PLAYING)

def eos(bus, message):
	print "EOS"
	player.set_state(gst.STATE_NULL)
	gtk.main_quit()
	
def error(bus, message):
	err, debug = message.parse_error()
	print "Gstreamer error: %s, %s" % (err, debug)

bus.connect("message::eos", eos)
bus.connect("message::error", error)

start()

gtk.main()
