嗨,我需要循环音频文件一定次数,即 4 次,我的声音文件循环正确,代码如下。? 4x后如何停止循环,非常感谢P
$('#play_audio').click(function () {
var audio = document.createElement("audio");
audio.src = "files/windows%20default.mp3";
audio.addEventListener('ended', function () {
// Wait 500 milliseconds before next loop
setTimeout(function () { audio.play(); }, 500);
}, false);
audio.play();
});