本文介绍了如何在JavaScript中播放声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下内容:
<audio id="clickdown-wav" src="ClickDown.wav" preload="auto"></audio>,然后在我的JavaScript,我有:
and then in my JavaScript, I have:
var ClickDown = $('#clickdown-wav')[0]; $(document).delegate('a','click',function() { ClickDown.play(); });问题是,这不是太活泼的(在iPad上),因为我preSS锚标记。有时间我preSS锚标记和WAV文件播放之间有明显的滞后。
The problem is that it's not too snappy (on an iPad) as I press anchor tags. There is a noticeable lag between the time I press the anchor tag and the wav file plays.
问:是否有来源$ C $ C唯一的解决方案,以从JavaScript播放声音?Clickdown.wav只有1K。
Q: Is there a source code only solution to playing sounds from JavaScript? Clickdown.wav is only 1k.
推荐答案在iOS上,没有preloading。这是由苹果进行有目的的,以使用户将不必使用不必要的带宽
On iOS, there is no preloading. This was done by Apple on purpose, so that the user wouldn't have to use unnecessary bandwidth.
更多推荐
如何在JavaScript中播放声音
发布评论