我是HTML5新手,我想点击暂停按钮获取音频持续时间
这是我的代码
<audio controls="" id="audio">
<source src="assets/record_file/abc.mp3" type="audio/ogg">
<source src="assets/record_file/abc.mp3" type="audio/mpeg">
Your browser does not support the audio element. Please try other latest browser
</audio>
任何想法怎么做?
感谢
答案 0 :(得分:0)
document.getElementById('audio').pause = function() {
var currentTime = document.getElementById('audio').currentTime;
var duration = document.getElementById('audio').duration;
alert(currentTime);
};
请检查HTML Audio and Video DOM Reference,描述所有方法,属性和事件。