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

145
Vistas
getting javascript Audio component to reload

I am using vue and electron for an app that, among other things, plays audio. The app uses the standard 'Audio' constructor to play the first clip. Then the app rewrites the audio and tries to play the new audio (with the old name) again. Right now the old audio plays even after the new track has been saved.

How do I force the Audio component to reload the track?

    const audio = new Audio(require("../sample.mp3"));
    audio.play();

Thanks. Any help would be appreciated. I actually use a 'ended' callback which is not shown in the code snippet.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Your script does not have control over how the browser manages the cache.
This can be regulated by using cache headers that are sent by the server to instruct the browser how to manage the cache.

That aside, a common way to solve caching (as often done by bundlers) is to generate a new filename with unique hash for every version of the file.
This way you don't have to worry about cached files.

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