我试图贬低类似于Adward的音频文件的期限,我可以认为这一公式是正确的。 我搜索了,但找不到我所期待的东西。 我确信,这将是某个人的一些容易的 st流点。
这里几乎是我从事以下工作的实例:
Basically, if you push play, it will start a timer for the song. Time elapsed works fine, however I m having trouble with the countdown. I can t get the seconds to countdown correctly. Here s the JS for the countdown portion: (please refer to my fiddle for the rest)
// Countdown
audio.addEventListener("timeupdate", function() {
var timeleft = document.getElementById( timeleft );
var ml = parseInt((audio.duration / 60 - audio.currentTime / 60) % 60);
// Here s the incorrect seconds countdown calc
var sl = parseInt(audio.duration % 60 - audio.currentTime);
if (sl < 10) {
timeleft.innerHTML = ml + :0 + sl;
}
else {
timeleft.innerHTML = - + ml + : + sl;
}
}, false);
感谢大家