AudioPlayer stops when the scene is loading only on the web version

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rvenson

I have some issues with the Godot web export on 3.1.2 (but it happens with 3.2.1 too). I have a singleton node (with autoloader function) that handles all the scenes of my game. But sometimes the background music just stops or stuttering when I loading a scene.
I tried some workarounds, but no one resolves my problem:

  • Changed output audio latency on Project Settings > Display > Audio
  • Disabled v-sync option
  • Recreating script processor (link)
  • Separate AudioPlayer on another autoload node
  • Load scenes on background with load_interactive (link)

I think that the only method that really reduces the stuttering was the load_interactive. Now, only scenes with complex scripts made my music stuttering.
Actually, my scene looks like this:

  • Game
  • SceneLoadedByGame
  • BackgroundMusic

Where the Game and BackgroundMusic are loaded by autoloader and the scene is loaded by the game script via load_interactive. The function only clears the last scene and load the new one.
In my knowledge, the Game branch should never block the execution of scripts that don’t are a child. This happens only on web export of the game, on Linux and Windows exports it works well. I only found this issue related to iOS.
I imagine that maybe I am not understanding some concept, so I appreciate any kind of help.

:bust_in_silhouette: Reply From: AkMor

I have the exact same problem on Godot 3.5. Some browsers work better than others but global sounds still chops up when scenes are changed. I think for now, the only option is to set a timer for scene change, and ease out volume during that time.