Search code examples
javaandroidaudioandroid-mediaplayersoundpool

android repeatedly play a mp3 file without any gap


I want to play a mp3 file from sdcard repeatedly without any gap. I am using MediaPlayer.setlooping(true) method to repeatedly play the mp3. it works fine. But it gives a gape of few seconds between repetition. I also looking for soundPools but it also give some gap. So is there any class, method or some idea that help me to eliminate the gap of few seconds.


Solution

  • After doing some handy experiments at last i got my solution using

    mPlayer.setLooping(true);

    mPlayer is an instance of MediaPlayer class. Although this line of code looping the code but this have a few gap between consecutive sounds. However finally it works for me. Any one can give a try to MediaPlayer class. its really awesome for handling audio file.