Question

I am trying to listen to the on_eos event of the pyglet.media.ManagedSoundPlayer following the examples in the pyglet documentation and end up with code like this:

from pyglet.media import load, ManagedSoundPlayer

def on_eos():
    print "EOS"

def play(source):
    player = source.play()
    player.on_eos = on_eos

src = load("beep.mp3")
play(src)

As expected, I do hear a "beep" - but to my surprise and frustration, "EOS" is not printed.

Did I miss something in the docs? Am I doing something wrong? What should I do to make this work?

Thank you!

Was it helpful?

Solution

Accordingly to this old link to pyglet Google group you need some tricks to reuse on_eos. It is still not implemented. Take a look on the sample from documentation how to implement on_eos event: http://www.pyglet.org/doc/programming_guide/media_player.py

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top