godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.04k stars 21.18k forks source link

yield AudioStreamPlayer finished signal on html export not working #43040

Closed dpensky closed 4 months ago

dpensky commented 4 years ago

I have this code:

$background.stop()

yield($background, "finished")

emit_signal("game_load_requested", game_name)

that works perfectly on the engine and the signal is emitted after the sound stops.

however when I export to html, the signal is emitted immediately, before the sound stops.

is this an engine problem or what am i doing wrong?

$background is a AudioStreamPlayer with a ogg file playing on loop

tanks in advance

Chlipouni commented 3 years ago

I have the same problem in my project (v3.2.4.beta4.official). In desktop mode, the sound is played once and the "finished" signal is emitted at the end. In hmtl5 export, the sound is played indefinitely (in loop mode) and the "finished" signal is not emitted (may be the correct behaviour in this case). To obtain the same behaviour in both cases, it is necessary to set the "loop" property to "false" explicitly (for the "AudioStreamOGGVorbis" instance). It seems that the default value of the "loop" property is not the same in Html5 exports.