xpenatan / gdx-teavm

Run Libgdx in a webbrowser with teavm
Apache License 2.0
108 stars 16 forks source link

AudioContext issue: Music play causes 'Cannot read properties of undefined reading "0"' #133

Open Quillraven opened 17 hours ago

Quillraven commented 17 hours ago

Hi,

I have an issue which I think is related to playing music. The game crashes (see screenshots below). However, I am not sure why this happens or how to solve it. Can you please help?

I have a LoadingScreen which does not play any audio at all. It is responsible for loading all the assets including music/sound. After that, the user is required to click to continue to the main menu.

In the main menu I play a music file which causes the problem. I read in google that in web development someone should call "getAudioContext().resume()" to fix that problem but how would I do that?

If it helps, here is the link to the project I am trying to run in TeaVM. The branch is "update2024" and not master: https://github.com/Quillraven/Quilly-s-Adventure/tree/update2024

image image

xpenatan commented 2 hours ago

Hi @Quillraven. Snapshot contains the fix. For some reason this error was not happening using MusicTest so I didnt catch it before.

There is still issues with pool objects using reflectionpool. Its better to setup all pools manually instead of using ReflectionPool to get away of refleciton headaches