Android SoundPool: get notified when end of played

This is what I do:

On startup I get the length of each sound-click using a MediaPlayer:

private long getSoundDuration(int rawId){
   MediaPlayer player = MediaPlayer.create(context, rawId);
   int duration = player.getDuration();
   return duration;
}

and store the sound plus the duration together (in a DTO-type object).

Leave a Comment