Hmm, I thought I was doing that but maybe I was doing it incorrectly.
The way I tried to work around this is by loading all sounds resources in the project in the main menu, so I have a SoundLoader class that looks something like:
const files_to_load: Array[AudioStream] = [
preload("res://Enemies/Zombie/Sounds/RoundhouseDamage/PUNCH_SQUELCH_HEAVY_01.wav"),
preload("res://Levels/loop_rain.ogg")
]
func load():
for stream in files_to_load:
AudioServer.register_stream_as_sample(stream)
and in my main menu class I create this class and invoke the load function:
func _ready() -> void:
print(OS.get_name())
# Register all sounds as samples on web version
if OS.get_name() == "Web":
var loader := SoundLoader.new()
loader.load()