Jump to content

"No 'Access-Control-Allow-Origin' header is present" Only happens when trying to loud audio files


Normangorman
 Share

Recommended Posts

I'm loading the static assets for my game from a cdn.

Previously I faced problems with the 'No 'Access-Control-Allow-Origin' header is present' error, which I overcame by setting game.load.crossOrigin = "Anonymous".

However now I am trying to load some .ogg files from a directory on the server, and the error is back. A sample from the Javascript console is:

 

XMLHttpRequest cannot load http://mycdn.com/static/games/mygame/sounds/power_up.ogg. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. 

 

Localhost:8080 is the port on which I am running a grunt server. 

 

I'm loading static files using the standard Phaser.Loader method:

 

game.load.image('cloud1', 'mycdn.com/images/cloud1.png');

 

Does anyone have any ideas as to why this issue might be happening?

Note that the problem only occurs for audio files.

Anything I load with with game.load.image(..) or game.load.spritesheet(..) is fine.

It's game.load.audio(..) that doesn't work.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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