Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

182
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda