Search code examples
androidaudiolibgdx

How to prevent the libgdx Sound class from restarting the song when using song.loop() in an Android game?


I've added music to my Android game using the libgdx Sound class. However, when I use song.loop(), the song restarts before it finishes playing. How can I prevent this from happening and make the music loop seamlessly?

Thank you for your help!


Solution

  • If your sound file is longer that few seconds you should use the Music class, not the Sound class.