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

205
Views
Updated Audio file is not being played when the button is pressed

Currently I'm having a web page that can play updated audio clips store locally in a folder produced from some other service. The audio that I play when button is being pressed is the previous audio clips(probably due to cache?). Unless i manually close the tab and reopen another tab.

Is it possible to let the or JS function to load the audio file every time before play

<td style="position:relative; top:1px;">
<input id="scream"
type="button"
class="btn"
onclick="play_single_sound()">
</td>

<audio src="{{url_for('static', filename='/screams/new_scream.wav')}}" id="audiotag1" autoplay="autoplay" preload="metadata"/>
<source src="/screams/new_scream.wav" type="audio/mpeg">
</audio>


<script type="text/javascript">
#FIRST METHOD
<!--                var song = document.getElementById('audiotag1')-->
<!--                function play_single_sound() {-->
<!--                    song.play();-->
<!--                }-->

#SECOND METHOD
window.play_single_sound = function() {
document.getElementById('audiotag1').play();
}
</script>

I have also attempted with loading audio as instance inside JS, as follows:

var song = new Audio ("../screams/new_scream.wav");
song.preload="auto";
song.play();

All the above methods doesn't allow me to play song clip that change dynamically in a static folder. Any advice ?

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

0

Remove autoplay attribute

<audio src="{{url_for('static', filename='/screams/new_scream.wav')}}" id="audiotag1" preload="metadata"/>
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!