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

185
Views
Runtime Create Audio Fail - Refresh from Cache or Server?

I am creating Audio at runtime and then setting the source.

let snd = new Audio();
snd.src = "file.mp3";

It works in Edge every time. Occasionally, it fails in Chrome, especially when I am debugging. It only really fails on the first time I start debugging in a session, almost always working every time after. Once it works, it repeatedly works for that session.

Note the error is MEDIA_ERR_SRC_NOT_SUPPORTED, which I know is not true, because it works, typically, the second time.

From what I have read here on Stackoverflow, there may be a known problem with this for large sound files (which this is in my case).

So my solution is, refresh the page when an onerror is fired:

snd.onerror = _ => window.location.refresh(true);

Note the true.

When you do this true means you are refreshing from the server. false means you are refreshing from the cache.

QUESTION: Considering my problem, which should I be doing, true or false?

Because of the low fail-rate, this is a real pain to debug, so any advice will be much appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think it is true. That worked every time. false only worked a few of the times. But as I say, since this is an intermittant error, it is very difficult to debug.

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