Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

86
Views
angular webpage resource not found

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

solved it, just put it in the assets folder and navigate to it, for me the path was "../../assets/whatever.mp3"

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!