Search code examples
androidaudiosoundpool

how to loop mp3 sound file without gap in android


their are some questions on stackoverflow about looping sound in android but neither gave me correct answer so i start new thread, I want to loop a sound without gaps in android. I tried to use the code mediaplayer.setLooping(true) for mp3,ogg and wav file to loop the sound, but there is always a little pause when the first sound is over and the next sound start..my audio length is 2 min. and file size is more than 1 mb so i cant use soundpool for repeating sound. i didn't know how to solve this issue.


Solution

  • Ok basically you have to create two objects of media player and then if time of first music is going to b finished then call the other one and your problem is solver