Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

149
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda