How can I check if loaded sound is decoded and ready?

Hi all first time poster here.

I was wondering how to check if the loaded sound is 100% decoded and ready?

For Phaser 2 I used to use Sound.isDecoded, but it’s no longer available with Phaser 3.

It’s no fun having no BGM for the first 20 seconds of the phone game and I can’t find any relevant resource.
I could alternatively use uncompressed WAV format but it doesn’t solve the issue 100%.

I’m also interested in a solution to this problem.

I tried a number of suggested solutions found on quora and elsewhere but without success. So now I converted the mp3 to wav which means my background music track’s filesize is almost 6MB, compared to 1.34MB before.

Btw. what is the math here? Filesize means slower download times, so it depends on a good internet connection, while decoding time probably depends on CPU? Which one is the actual limiting factor for a low-end mobile device?

Update: Even with a WAV instead of an MP3 the first 10-15 seconds of gameplay is without background music in my game, when played on mobile. There must be a solution to this - what does everyone else do to check if music is fully loaded and decoded?

See WebAudioSoundManager#decodeAudio() etc.

Thanks. I wish decoding were just part of the load() method for audio - who really needs to separate those steps anyway? At least it could be optional part of the load method, with a default flag set to true. Seems much easier to include audio loading and decoding in a preloader that way.

I take that back, decodeAudio() isn’t for downloaded audio.

So when using Web Audio decodeAudioData() is done during the loading process and should be complete before the audio file is added to the game cache.