Jump to content

Audio file can't be loaded


devbruce
 Share

Recommended Posts

Hey guys,

when I try to load my audio file it doesn't work.

That is what I do in my preload function:


    this.load.audio('theme', [
        'assets/Runn.wav',
    ]);

That is how I try to use it in my create function:

    music = this.sound.add('theme');
    music.play({
        loop: true
    });

 

It worked, but as soon as I try to change the name of the key or the name of my audio file, it doesn't work anmyore and the following messages begin to appear:

I get the following warning message: ' Audio cache entry missing: theme '

I also get the following error message: ' TypeError: this.currentConfig is undefined '

 

I hope you can help me with that. Thanks in advance.

Link to comment
Share on other sites

devbruce, Could you ever try load the sound by single file instead of an array like that

 

this.load.audio("theme", ["assets/Runn.wav"]);

=> this.load.audio("theme", "assets/Runn.wav");

Otherwise you don't need line code " add sound" to play the sound.

music = this.sound.add('theme');

music.play({ loop: true });

=> this.sound.play("theme");

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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