Weird sound issue when after switching between scenes

Phaser 3.24.1

I am using audiosprite for background music. I have this line in preloader create.
this.sound.playAudioSprite('key', 'marker', { loop: true });

This is to make the bg music start and loop forever. When switching between scenes I saw the sound is not muting on blur after sometime. After this happens, the sound does not loop and stops at the end.

This was a very difficult one because I had to manually comment out line by line until I found out I was calling this.registry.events.removeAllListeners() on a scene shutdown.

I changed it to remove the specific event I’ve added to the registry and the bug disappeared. :woozy_face:

:wave:

Switching scenes shouldn’t affect sound playback at all.

It was really the registry removeAllListeners problem.

Yeah, the title was somehow misleading.