Reputation: 363
Is there a way I can tell if a certain sound is playing in SoundPool??? I.E.
if(MySound./*Command Goes Here*/()==true{
//Do stuff
}
I would appreciate if you could point me in the right direction or give me the code. I am not able to find any thing that does this on the docs.
Upvotes: 4
Views: 5713
Reputation: 14153
This is not possible using SoundPool
.
See Android SoundPool: get notified when end of played for two other ideas:
MediaPlayer
, which provides an OnCompletionListener
, instead of SoundPool
MediaPlayer
in conjunction with SoundPool
. Load the sound in a MediaPlayer
beforehand to get the duration and keep track of whether the sound is done playing based its duration when played with SoundPool
.Upvotes: 2