English 中文(简体)
1. 声传时间缩短
原标题:Countdown audio duration javascript

我试图贬低类似于Adward的音频文件的期限,我可以认为这一公式是正确的。 我搜索了,但找不到我所期待的东西。 我确信,这将是某个人的一些容易的 st流点。

这里几乎是我从事以下工作的实例:

http://jsfiddle.net/philbot/tfSTh/。

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);

感谢大家

最佳回答

我只是计算剩下的时间和格式,即你想要什么?

jsfiddle:

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签