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!

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;

Hello,

Thank you! That was helpful.

Regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.