Minor correction: pyglet.clock.schedule_once(pyglet.app.exit, stream.duration) because using pyglet.app.exit() in it would just call that, rather than setting it as a callback.
On 26 August 2012 07:37, Pranav Ravichandran <[email protected]> wrote: > You need to use the clock.schedule_once() method to exit the running process > once the duration of the file is over. > > stream = pyglet.resource.media(mediaFile) > stream.play() > pyglet.clock.schedule_once(pyglet.app.exit(), stream.duration) > pyglet.app.run() > > > On Fri, Aug 24, 2012 at 1:23 PM, Thomas Weholt <[email protected]> > wrote: >> >> I want to use pyglet to play a sound clip in a method and then return, but >> in the examples I've seen so far you call >> >> pyglet.app.run() >> >> which enters a loop I cannot escape from. How do I get a method that plays >> a sound and then just returns, no waiting around for keyboard events etc cuz >> that's not going to happen. >> >> If there are easier multiplatform ways to play sounds in python not using >> pyglet that be ok to, but I'd like to get into pyglet programming so ... >> >> Anyway, thanks in advance. >> >> Thomas >> >> -- >> You received this message because you are subscribed to the Google Groups >> "pyglet-users" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/pyglet-users/-/Ovgrvi10qaEJ. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/pyglet-users?hl=en. > > > > > -- > E-ThoughtDumpyard > > > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pyglet-users?hl=en. -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
