Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to loop a sound without gaps in Android?

Tags:

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.

like image 551
BrantYu Avatar asked Nov 16 '12 02:11

BrantYu


People also ask

How do I loop a song in Android Studio?

spool. play(soundID, volume, volume, 1, 0, 1f); the number 0 represents the number you want to repeat the song. For infinite loop the suitable value is -1.


1 Answers

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.

like image 90
Finding Nemo 2 is happening. Avatar answered Oct 27 '22 18:10

Finding Nemo 2 is happening.