Hi @chenphilip14, are you maybe trying to load the audio file from your file system? This won’t work, you’ll have to pass a URL to the audio source.
If you’re using some sort of dev server though (such as vue-cli-service serve), make sure that the media folder is served as a static asset folder and the path is correct – that is, relative to the app root, not relative to the path of the component playing the sound.
This will also work with your file system… or, if you want to play audio files from the file system of the user visiting your page, you can add a file input and create an object URL from the selected file, which again you can pass to the Audio() constructor:
This might help, I am running this code using Notepad++. Notice the address is my D:\ drive in the tab.
I am not using a server, only opening the html in Edge as my browser. Check out the quick video,
I have no controls enabled yet; I only can get it to play. Page refresh stops it … and I am just figuring out JavaScript on my own. I have basic knowledge, but I am learning … but you can see it works without a server.