Hãy thử mã sau để thêm nút dừng vào âm thanh của bạn trong HTML5:
function displayStopBtn() {
var myPlayer = document.getElementsByTagName('audio')[0];
myPlayer.pause();
myPlayer.currentTime = 0;
} Bạn cũng có thể bao gồm jQuery:
$("#stopButton").click(function () {
audio.pause();
audio.currentTime = 0;
});