I use soundpool to play audio files, and my goal is to play an audio file and play another audio file after playback ends.
Here is my code
String source_path = "/sdcard/varun/audio.mp3"; mSoundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0); mSoundPool.setOnLoadCompleteListener(new OnLoadCompleteListener() { public void onLoadComplete(SoundPool soundPool, int sampleId, int status) { loaded = true; } }); sound1 = mSoundPool.load(source_path, 1); hand1.postDelayed(new Runnable() { public void run() {
Here I hardcode the values ββas 21000, but I need to get the duration of the audio file, because the duration varies with each file. I am working on Android 2.2
How to do this, please help?
source share