参考:https://stackoverflow.com/questions/19355952/make-html5-video-stop-at-indicated-time
<html>
<head></head>
<body>
<button onclick="setCurEndTimeAndPlay(5,11.48)" type="button">点击播放</button>
<br>
<br>
<audio id="audio1" controls="controls"><source src="D1T02 - Wuthering Heights.mp3"></audio>
<script>
myAud=document.getElementById("audio1");
function setCurEndTimeAndPlay(startTime,endTime){
// 设置当前时间
myAud.currentTime=startTime;
// 设置暂停时间
// var endTime = 11.48;
myAud.addEventListener('timeupdate', function () {
if(myAud.currentTime>endTime){
myAud.pause();
}
}, false);
myAud.addEventListener('loadedmetadata', function () {
myAud.play();
}, false);
// 播放
myAud.play()
}
</script>
</body></html>
2.
<html>
<head></head>
<body>