pygame-web / pygbag

python and pygame wasm for everyone ( packager + test server + simulator )
https://github.com/pygame-web
MIT License
319 stars 36 forks source link

Queueing music does not work #149

Closed queueseven closed 7 months ago

queueseven commented 8 months ago

In pygame, you can do something like this:

pygame.mixer.music.load(os.path.join('res', 'music', music.intro))
pygame.mixer.music.play(loops=0)
pygame.mixer.music.queue(os.path.join('res', 'music', music.loop), loops=-1)

to play in intro, and when it's finished, the second music file is played in a loop.

That's easy and works totally fine.

But that does not seem to work with pygbag: the second music file starts playing before the first one is finished.

I also tried several other ways of getting such an intro/loop-music track combination to work, but without success. The end event (music.set_endevent) does not work, [music.set_pos](https://pyga.me/docs/ref/music.html#pygame.mixer.music.set_pos) does not work (not supported). I tried manually checking the state of the music player (pygame.mixer.music.get_busy) and then load the second music file, but that does also not work because the browser gives me AbortError: The fetching process for the media resource was aborted by the user agent at the user's request.

pmp-p commented 8 months ago

please make a repro case with full code and assets ( a gist.github.com can do ) as the basic test seems to work for me https://pygame-web.github.io/showroom/pypad.html#src/test_mixerqueue.py

refing https://github.com/pygame-web/pygbag/issues/118 for completeness of queue usage

queueseven commented 7 months ago

OK, I tried to create a minimal reproducible example. It seems to be a problem with pygame itself and not pygbag, as I was able to reproduce my problem without pygbag.