0

Hello,

I am working with the AudioClip class. It has methods for playing, stopping and looping an audio file (.wav/.au). Is there a way I can check when an audio file has completed playing? The stop() method is void. Is there any other class I can use?

Thank you!

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by javaprog200
0

There is no method in the AudioClip class itself to return this value (as I'm sure you've already figured out). If you're looping the sound, what I would do is declare a boolean variable and change it when you start or stop the loop. For example:

boolean isPlaying = false;
sound.loop();
isPlaying = true;

// Some more code

sound.stop();
isPlaying = false;
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.