Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I know if a sound is finished playing in android?

How do I know if a sound has finished playing?

I want to play 2 sounds but I want one sound to play and then wait until the 1st sound is done before the 2nd starts.

Also, if I wanted to do something else when the sound is finished like show he next view in a view flipper, could I do that?

Right now I'm using SoundPool to play my sounds.

like image 269
cmerrell Avatar asked Nov 30 '10 23:11

cmerrell


People also ask

Which MediaPlayer callback method will notify us when the MediaPlayer has finished playing the audio file?

onCompletion. Called when the end of a media source is reached during playback.


1 Answers

Use the MediaPlayer class and an OnCompletionListener

like image 70
Dahlgren Avatar answered Oct 13 '22 19:10

Dahlgren