Html5 audio stop

时间:2023-03-09 16:23:03
Html5 audio stop
 //html5 stop audio play
function stopPlay(el){
el.pause();
el.currentTime = 0;
}

使用:

var el = document.getElementById("eva2_m3");

stopPlay(el);

参考了:HTML5 Audio stop function

 HTMLAudioElement.prototype.stop = function()
{
this.pause();
this.currentTime = 0.0;
}

这个方法虽然差不多的效果,但是在chromium浏览器下无法使用,所以只好使用第一个方法进行替换这个方法