joshwcomeau / use-sound

A React Hook for playing sound effects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Works in local not in Amplify Deployment

lvillacin opened this issue · comments

It does not work after I deploy my react application but it works fine in local.

I use use-sound from within a useEffect as it looks at an array of messages.

What do I do?

Afraid I'm not sure, and I don't have the bandwidth to offer support. Sorry!

@lvillacin Have you found a workaround on this ?

Found the solution.

https://stackoverflow.com/questions/66835474/audio-tag-not-working-in-reactjs-application-deployed-in-aws-amplify

You need to add an mp3 file extension to your application's URL rewrites in Amplify.

In your app's homepage in Amplify click on 'Rewrites and redirects' under App Settings. Then click edit and add mp3 to the list of extensions in your rewrite rule.

It'll probably look something like this after you add it:

</^[^.]+$|\.(?!(css|gif|ico|jpg|jpeg|js|png|mp3|txt|svg|woff|ttf|map|json)$)([^.]+$)/>

</^[^.]+$|.(?!(css|gif|ico|jpg|jpeg|js|png|mp3|txt|svg|woff|ttf|map|json)$)([^.]+$)/>