Jump to content

Decode Audio, check if is ready to next state (mobile)


Recommended Posts

Hi, I'm trying to check if the audio is ready before start the MainMenu.

    create: function () {        this.addGameSrc();        Vendor.addSound();        Vendor.addMusic('main_menu', true);        audios = [ music, sfx_Click, sfx_Drop, sfx_Explode ];        console.log(audios);        this.status.setText('DECODING AUDIOS...');        this.sound.setDecodedCallback(audios, this.start(), this);    },    start: function () {        this.status.setText('READY');        setTimeout(function () {            game.state.start("MainMenu");        }, 250);        console.log("Splash\t\tOK");    },

ERROR: TypeError: this._watchCallback is undefined



I also tried this code:

    create: function () {        this.addGameSrc();    },        update: function () {        if (game.cache.isSoundReady('click', 'main_menu')) {            this.startMenu();            } else {            this.status.setText('DECODING AUDIOS...');        };    },        startMenu: function () {        this.status.setText('READY');        this.state.start("MainMenu");        console.log("Splash\t\tOK");    },

But it takes so long for decode, tested with S6 Edge and about 10 seconds waiting, doesn't matter if the audio is an mp3 or ogg with 5k or 500k, if it's one single file or ten files, make no sense for me...

Plz, Someone can help me to fix this? :)



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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