Trying to locate a sound file but it can't be located and running the code gets this error(GET file:(file path here) net::ERR_FILE_NOT_FOUND)

Viewed 385

I tried adding (../) (../../) and also tried using the Path Intellisense extension which located it but the error still appears

this is how the extension located it

const hitSound = new Audio('../sounds/Ta Da-SoundBible.com-1884170640.mp3.extension');

I have the same error earlier and I wrote the full path starting from the drive name cardImage.src = 'B:/Html, CSS & Js/js excersing/photos/KS.png' and it worked but when I tried it on the code above it didn't work

1 Answers

If the path '../sounds/Ta Da-SoundBible.com-1884170640.mp3.extension' in your javascript/html file would be correct, it would mean the following: The directory that contains the directory where your javascript/html file is located also contains a directory sounds where your sound file resides.

For a start, copy the sound file into the same directory as your javascript/html file and load it with

const hitSound = new Audio('Ta Da-SoundBible.com-1884170640.mp3.extension');

The whitespace in the filename (the blank between Ta and Da) could also be a problem, so I suggest you also rename the file.

Related