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

255
Views
Why does this audio play() fail on iOS 14?

I have seen Why can't JavaScript .play() audio files on iPhone safari? and I know that a user interaction is required before playing an audio object. However, this doesn't work on iOS 14:

<div id="a">Click here</div>
<script>
var audio = new Audio('a.mp3');
audio.load();
document.getElementById('a').onclick = function() { 
    audio.pause();         // always restart the sound, see https://stackoverflow.com/a/13243338
    audio.currentTime = 0; 
    audio.play(); 
}
</script>

With this code, no sound is produced which clicking/touching on the <div>, with an iPhone on iOS 14.

How to solve this?

about 4 years ago · Juan Pablo Isaza
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!