Jump to content

New event onFileComplete for decoded audio files


Recommended Posts



On an audio file, is there a way to fire the event Loader.onFileComplete only when the file is decoded ?


Phaser states logic is based on preload and create functions.

When preload is endend we call the create function. But sounds are not always decoded.

Is there a way to upgrade this behavior?  I would like to start the create function only when sounds are fully decoded.


Please note I don't need a specific flag on my side to wait until my sounds are decoded. I need a Phaser logic here.


I guess a new parameter in the Loader.audio function could do the job:

game.add.audio(key, urls, autoDecode, fireFileCompleteEventOnDecoded)
Link to comment
Share on other sites

I ask this request because sounds on small mobile devices can take few seconds to decode.


On IOS devices sound decoding is quite fast (like on desktop).

But on last generation of Google Nexus or Samsung Galaxy tab the decoding takes few seconds.

Average 3-4 seconds for a 250K MP3 sound file  :o

Link to comment
Share on other sites

I understand, I'm doing this in a similar way for my current game.

But the goal was to use the create() function after preloading.


In Project Templates we use the update() function. In this way create() is already fired.

I could have my own callback(), but some third part script, such as Transition Plugin, use the create function because it's part of the Phaser framework.


Plus, the onFileComplete event is usually used to display a progress bar.

Using the update function() like in Projet Templates doesn't do the job.

Again I can write the progress display myself, but why not use the Phaser one?


Maybe I'm only in this case. It's my own wish list :-)

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...