Note does not work in Android 5.x. I know this is an old post, but I also ran into this problem. Zenopython's answer will work with some tweaking since there is an error in the mixer module. If you look in the anroid.mixer module and look at the music class that you will see.
@staticmethod def get_busy(): return music_channel.get_volume()
as you can see, it actually calls get_volume (), which always returns 1.0. To fix this, I copied the mixer.py file to my games directory and changed it to
@staticmethod def get_busy(): return music_channel.get_busy()
Then imoport mixer and it works. Sort of
import pygame try: import pygame.mixer as mixer except ImportError: import mixer if mixer: mixer.music.load("woo.mp3") mixer.music.play(-1) while True: if mixer: if mixer.music.get_busy() == False: mixer.music.play(-1)
It worked for me.
As mentioned above, this does not work in 5.x.
Another solution is simply a queue of music that works
mixer.music.load('music') mixer.music.play() mixer.music.queue('music')
In general, the mixer.music module in pgs4a has a number of errors. Another error I discovered is in mixer.music.pause () and mixer.music.unpause (). unpause () calls pause () again, so I also had to edit this to pause music when the game was stopped. See below
if android: if android.check_pause(): mixer.music.pause() android.wait_for_resume() mixer.music.unpause()
source share