joshwcomeau / use-sound

A React Hook for playing sound effects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sounds working locally but not after deploy

jknapp25 opened this issue · comments

My sounds are working locally, but not after I deploy...

Browser: Chrome
Setup: create-react-app
File formats: tried mp3 and m4a
File paths: relative
Stored in public directory?: no

@jknapp25 If you look in the JS console, are there any CORS related errors by chance?

are the sounds triggered by user interaction? On mobile devices I had to add this "hack" for playing sound once a message is sent to the user. https://github.com/dungeon-revealer/dungeon-revealer/blob/master/src/register-sound-playback.tsx

My guess is that the files aren't able to be loaded somehow, maybe because the paths change in production.