Reputation: 2385
I'm trying to loop a ~30 seconds audio track multiple times. I'm using a MediaPlayer
to play the sounds, here is the code where its created:
mAnimalMediaPlayer = MediaPlayer.create(mContext, fish.getSound());
I then call:
mAnimalMediaPlayer.setLooping(true);
mAnimalMediaPlayer.start();
when a play button is clicked. When the track loops, there is a small but noticeable pause between the track ending and the new loop beginning. I am positive that the audio file im using does not contain any actual pause.
Here is an android bug report which has been up for some time: https://code.google.com/p/android/issues/detail?id=18756
I've tried a few workarounds (such as using .ogg
files instead of .mp3
) but the problem persists.
I'm looking for any possible workaround that will allow me to seamlessly loop the playback multiple times.
Upvotes: 3
Views: 1339
Reputation: 79
There is a very noticeable pause. However, I have just discovered through experimentation on an emulator running level 25 that if one prepares two identical players and alternately starts them one after the other when the other has finished then the gap becomes much more difficult to hear.
Upvotes: 1