i am using soundpool to play audio files and my objective is to play a audio file and after finishing, play another audio file.
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() {
// TODO Auto-generated method stub
if (loaded) {
mSoundPool.play(sound1, 1, 1, 1, time - 1, 1);
System.out.println("playing=== a");
}
}
}, 21000);
Here i am hardcoding the values as 21000 but i need to get the duration of audio file because duration changes with each file.I am working on android 2.2
How to acheive this please help?