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

178
Views
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 answers
Answer question

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 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!