I am trying to convert seconds to MM:SS and for some reason it is not showing correctly.
jQuery('#player-recorded-call').get(0).currentTime;
is to get <audio>
current time position.
For example
audioCurrentTime
was set to 326.459368 which SHOULD be 05:26 (MM:SS) but for some reason it has been calculated to 05:84 (var dur
)
var audioCurrentTime = jQuery('#player-recorded-call').get(0).currentTime;
var minutes = "0" + Math.floor(audioCurrentTime / 60);
var seconds = "0" + (audioCurrentTime - minutes * 60);
var dur = minutes.substr(-2) + ":" + seconds.substr(-2);
$(".criteria-duration").html(dur);
I got this math example from https://stackoverflow.com/a/26206645/791022