how to play a sound file repeatedly in loop
MRAB
python at mrabarnett.plus.com
Sat May 8 19:29:07 EDT 2010
varnikat t wrote:
>
> How to run sound file repeatedly in loop ?
>
> When I do this, it does nothing and terminates:
>
> import pygst
> pygst.require("0.10")
> import gst, gtk
>
>
> n=0
>
> while n<10:
> player = gst.element_factory_make("playbin2", "player")
> player.set_property("uri", "file:/home/varnika/hello.ogg")
> player.set_state(gst.STATE_PLAYING)
> n=n+1
>
It's not doing nothing, it's repeatedly making a player, starting it,
and then on the next iteration making another player and starting it.
The line:
player.set_state(gst.STATE_PLAYING)
doesn't wait until the sound file has finished before returning.
More information about the Python-list
mailing list