Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

87
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda