Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

88
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda