so basically i'm trying to play some music from the ts file (working with angular) using the Audio type, on the src property I specified what I'm convinced to be the correct path, here's the code:
playMusic(){
console.log("Playing music");
let audio = new Audio();
audio.src = "./home_music.mp3";
audio.loop = true;
audio.load();
audio.play();
}
I put that path because the mp3 file is in the same folder as the ts file, only the browser gives me this error:
GET http://localhost:4200/homeMusic.mp3 404 (Not Found)
and it actually makes sense because the file isn't in that path, it's in /src/app/home/homeMusic.mp3, (I used ./file.jpeg in the CSS file to set a background image and it worked just fine but here apparently not)
of course I tried putting the whole relative path but I still get that error, any suggestions?
solved it, just put it in the assets folder and navigate to it, for me the path was "../../assets/whatever.mp3"