我怎样才能获得HTML5音频的持续时间 [英] How can I get the html5 audio's duration time
本文介绍了我怎样才能获得HTML5音频的持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个HTML5 <音频>
页面标签,但我怎么能知道它的持续时间
<音响控制=>
<信源SRC =p4.2.mp3>
< /音频>
解决方案
哪个浏览器,你想这个吗?在某些浏览器持续时间
不会,因为它应该回到正常工作 NaN的
你所说的。
此外,你确保音频文件已经试图检索期限之前加载?
I have a html5 <audio>
tag in page, but how can I know its duration time?
<audio controls="">
<source src="p4.2.mp3">
</audio>
解决方案
Which browser are you trying this on? On some browsers duration
doesn't work as it should, returning NaN
as you mentioned.
Also are you ensuring that the audio file has loaded before attempting to retrieve the duration?
这篇关于我怎样才能获得HTML5音频的持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文