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

179
Visualizações
Audio file playing in background once button is clicked

I have tried to get a audio file I downloaded as an mp3 to play on a webpage once a button is clicked. When I open my html with live server it is working fine. Something with connecting through heroku isn't recognizing the audio file. I've tried many tips from the internet but nothing is working. The file is in the same folder as everything else.

let button = document.querySelector('button')
let audio = new Audio("trash_Kid.mp3")

const buttonAlert = () => {
    audio.play();
    alert(`Get good kid!`)
}

button.addEventListener('click', buttonAlert)
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

Try to upload your .mp3 file in some another server and then just reference it with an absolute/external URL. Could be a Heroku limitation with audio files.

about 4 years ago · Santiago Gelvez 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