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

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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