Take the 2-minute tour ×
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It's 100% free, no registration required.

it is possible to use Python to signal when an mp3 file, or other audio file, has finished playing/reached their end? I know how to play them, as per the BGE code below, but don't how do I check if the are finished?

sound = aud.Factory('audio.mp3') #loads mp3 or wav file  
if not 'play' in ow: #will play sound only once 
     ow['device'] = aud.device() 
     ow['device'].play(sound)
     ow['play'] = 1

Thanks in advance!

share|improve this question

1 Answer 1

There's a status property: aud.Handle.status

You could check it in regular intervals until the status changes to AUD_STATUS_STOPPED or AUD_STATUS_INVALID, see the API docs.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.