I'm using html5 audio tag in my project. everything works fine.
I need to use the timeupdate and get the value of the minutes that has passed in this format: 00:00
Currently I can only get that value as 0:00
with my code:
This is my code:
$(audio).bind('timeupdate', function(){
var percent = audio.currentTime/ audio.duration * 100;
/////Passed time////
var mins = Math.floor(audio.currentTime / 60);
var secs = Math.floor(audio.currentTime % 60);
if (secs < 10) {
secs = '0' + String(secs);
}
$('.Audio_passedTime').text(mins + ':' + secs);
});
And a working fiddle: http://jsfiddle.net/8cpwv2mf/
Could someone please advice on this issue?
Thanks in advance.