How to loop a sound without gaps in Android?

BrantYu picture BrantYu · Nov 16, 2012 · Viewed 7.5k times · Source

I want to loop a sound without gaps in android. I tried to use the code mediaplayer.setLooping(true) to loop the sound, but there is always a little pause when the first sound is over and the next sound start.

Answer

Try using the .ogg file format for the sound files in your application. I had this same issue, and after a lot of research , i tried the .ogg format and it loops without any gaps in android.

Info about .ogg format: http://en.wikipedia.org/wiki/.ogg

You can easily convert your sound file from .mp3 or what have you, to .ogg using the popular open source app VLC Media Player.