Godot Version
Godot 4.6.1
Question
I only recently began exporting my game for web, and had to make a few changes for the “user must initiate sound” warning.
The game now runs in browser, with no warnings, but there’s no audio. Since there are no error messages, I’m not sure what else even to write. Are there any common pitfalls like this that anyone knows about?
Depends on the browser and the device.
Some browsers will not play any sound until the player actively interacts with the page that wants to play audio.
On iOS specifically, if you have “Silence” mode on, that will also completely silence games, including browser games.
1 Like
Yeah, that’s the warning I had to deal with. Now that I no longer get it, any idea why there’s still no audio? It’s the same in Chrome / Brave and Edge, any sense in testing more browsers?
I solved it by creating audio buses in the editor rather than in code, for some reason that did the trick. Now I’m getting audio, but my effects aren’t working, the code can’t seem to find them at their idx’s. I also still aren’t getting audio on itch.io, only when running a local web build.
This is actually a bug I logged. You have to create the buses in the editor or they do not work on web export. Although now it can result in a memory out of bounds error (or did at one point): Memory Access Out Of Bounds On Web Export: Migrating 4.5.1 -> 4.6 · Issue #115560 · godotengine/godot · GitHub
I’m not sure what you’re using for indexes for your buses, but I recommend finding them by String using the name you gave them in the editor.
Also, you might be better off creating AudioStreamPlayer objects that reference the appropriate buses and manipulate those in code.
1 Like
Thanks, that’s basically what I’m doing now… is it possible to refer to audio effects by name? Because I think that’s where the problem is at now. I’ve tried creating the effects in the editor (an LPF and a reverb) which still work in a desktop build, but audio with no audio effects on web build.
I always create my effects in a Bus and just send sounds to the Bus. That worked for me.
Thanks. Whether I do that by code or in the editor, I can’t seem to get audio effects in the web build. Oh well, that’s an acceptable loss 