I'm trying to run a setInterval function while playing audio. So I put the setInterval inside the timeUpdate function, unfortunately it triggers on every timeUpadte.
How would I need to write it?
var audio = document.getElementById('audioElement');
audio.ontimeupdate = function () {
setInterval(function(){
console.log("test");
}, 1000);
};
<audio id="audioElement" controls>
<source src="http://stash.rachelnabors.com/music/byakkoya_single.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>