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

139
Views
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 answers
Answer question

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 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!