Jump to content

Audio working local but not after publishing to web server


mBeierling
 Share

Recommended Posts

I am just starting with phaser and have built Pong as my first project to digg into it.

 

There is one problem I just can't solve: If I test the game locally the audio plays, if I publish it to my webserver, the audio does not play.

I sense it may have to do something with access rights (do I maybe need to add an htaccess?), or the web server settings are not correct.

 

My dev environment: Visual Studio 2013, Typescript, Phaser 2.3.0. If you need any further details (e.g. from my web hoster) to tell me what's going wrong, please don't hesitate to ask.

 

Game on the web server: http://games.martinbeierling.de/pong/

Sound that should play when the ball hits the player: http://games.martinbeierling.de/pong/assets/hit.wav

 

The code is working, as it plays it correctly when I test it locally by running it from Visual Studio in Google Chrome.

 

 

-> preload the assets

function preload(): void{    game.load.audio("hit", "/assets/hit.wav");    game.load.audio("explode", "/assets/explode.wav");}

-> in create, add the sounds

hitSFX = game.add.sound("hit");explodeSFX = game.add.sound("explode");

-> at the triggers, play the sounds

hitSFX.play();
Link to comment
Share on other sites

I'd suspect your web host doesn't have a suitable mime-type set-up for WAV files.

 

As wav files don't work in lots of browsers (IE included) you'd probably be safer moving to something more common instead. Personally I'd use m4a AND ogg, then you'll cover them all.

Link to comment
Share on other sites

  • 1 year later...

Hey. I'm having the same problem. Tried ogg, mp4 and wav. On both github pages and my personal site I'm getting 'phaser.js:74719 GET http://MYSITE.co.uk/assets/sounds/MYSOUND.ogg 404 (Not Found)'

 

Edit: looks like the problem was that my Sounds folder started with a capital S, in the code I was using a small s. Is this a linux thing?

Edited by An Actual Crowbar
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...