I would like to display the current time of of an html 5 audio element and the duration of that element. I\'ve been looking over the internet but can\'t find a functional sc
robertc's version will work fine except for the fact that it does not turn the number of seconds you get from math.floor()
into proper time values.
Here is my function called when ontimeupdate
is called:
I modified formatSecondsAsTime()
from something I found here:
function formatSecondsAsTime(secs, format) {
var hr = Math.floor(secs / 3600);
var min = Math.floor((secs - (hr * 3600))/60);
var sec = Math.floor(secs - (hr * 3600) - (min * 60));
if (min < 10){
min = "0" + min;
}
if (sec < 10){
sec = "0" + sec;
}
return min + ':' + sec;
}