I'm using in my app two mediaplayers. I want play first song (mp1) and then play second song (mp2). But there is a little gap/silence between these songs. Is it possible somehow remove?
I create MediaPlayers (mp1 and mp2) in OnCreate() method:
mp1 = new MediaPlayer();
mp1.setAudioStreamType(AudioManager.STREAM_MUSIC);
mp1.setOnCompletionListener(mySongCompletionListener1);
mp2 = new MediaPlayer();
mp2.setAudioStreamType(AudioManager.STREAM_MUSIC);
mp1.setDataSource("/storage/emulated/0/IAMDJ/SAMPLES/Free Future Kits/Drop/WA FFHK Drop1.ogg");
mp1.prepare();
mp2.setDataSource("/storage/emulated/0/IAMDJ/SAMPLES/Free Future Kits/Verse/WA FFHK Verse1.ogg");
mp2.prepare();
And:
private OnCompletionListener mySongCompletionListener1 = new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mp2.start(); //first song finished, start second...
}
};
Note: I don´t want use SoundPool because it doesn't have seekTo().
Is it possible to remove the silence?
Using setNextMediaPlayer (as Michael advised) is right and good solution.