I have an audio file called sound.wav
that is 14 seconds long. When a user clicks a button, sound.wav
source url is changed and sound.wav
is reloaded and is now 7 seconds long.
However, my browser does not display the changes. Only after clicking the refresh button does it display the changes.
Here is my code:
<div id="audioContainer">
<audio id ="myAudio" controls>
<source id = "wav_src" src="http://localhost:3000/sounds/sound.wav" type="audio/wav">
</audio>
</div>
//user clicks button... sound.wav's url source is changed
document.getElementById("myAudio").load(); //code to reload the sound.wav
As you can see, I'm reloading the html audio element for sound.wav
after the user presses a button. However, the sound file remains unchanged on the website, unless I hit refresh.
How do I fix this?