【发布时间】:2012-02-29 03:28:51
【问题描述】:
知道如何让 Chrome 在第二次点击后再次播放声音吗?与 Firefox 配合使用即可:
<html>
<head>
<title>audiotest</title>
<SCRIPT language="JavaScript">
var snd = new Audio("img/meow0.ogg");
function test(){
if(snd.currentTime>0)
snd.currentTime=0;
console.log(snd.currentTime);//0 on firefox, initially 0 on chrome, then == snd.duration
snd.play();
}
</SCRIPT>
</head>
<body>
<a href="javascript:test();">test</a>
</body>
</html>
【问题讨论】:
-
Chrome 会通过多次点击播放一整天的音频文件
-
这似乎是 Chrome 中的一个错误。 forestmist.org/2010/04/html5-audio-loops中方法二的音频不重播
标签: html google-chrome audio