Hello! I'm trying to make a slider for the player, but the problem is that when I create an audio
object, I can't call a method inside a function and have to call setInterval
twice. Tell me, please, can I somehow fix this?
That is, you have to do this:
var audio = new Audio(); setInterval("var a = Math.floor(audio.currentTime / (audio.duration / 200))", 500); setInterval(function(){ $('#timeline').css({"width" : "" + a + "px"}); }, 500);
Instead of doing this:
var audio = new Audio(); setInterval(function(){ var a = Math.floor(audio.currentTime / (audio.duration / 200)); $('#timeline').css({"width" : "" + a + "px"}); }, 500);