I have a vanilla js vite project. I'm struggling to import and play audio, it works properly in the dev environment but not in a static build.
The sound media file is stored as ./sounds/sound.mp3
At the very top of the html body I have the following element:
<audio type="audio/mpeg" src="/sounds/sound.mp3" autoplay></audio>
I have a button which pauses the audio directly below that. When you press it in build, console reads:
Uncaught (in promise) DOMException: The media resource indicated by the src attribute or assigned media provider object was not suitable.
You can see for yourself here, the sound button is at the bottom right of the page.