Currently i have a script streaming sound and save abnormal sound to wav format, stored it to flask folder under templates.
Flask web server is streaming some sort of video. It can also play abnormal sound in the static folder.
After i start my web server and when the play button is being pressed, the abnormal sound is being played. However when there is another abnormal sound is detected, the sound clip will be updated in the static folder but the same old sound clip will still be played on the html page.
I have tried to load the saved sound clip in the JS function like this in the index.html:
<audio src="{{url_for('static', filename='/screams/new_scream.wav')}}" type="audio/mpeg" id="audiotag1" preload="metadata"/>
</audio>
<script type="text/javascript">
var song = document.getElementById('audiotag1')
function play_single_sound() {
song.load();
song.play();
}
</script>
I have also tried to remove the cache in flask as following:
app.config["CACHE_TYPE"] = "null"
both methods can't solve the problem.
Any other suggestion so i play the latest audio clip on the html page?