I have the following:
<audio id="clickdown-wav" src="ClickDown.wav" preload="auto"></audio>
and then in my JavaScript, I have:
var ClickDown = $('#clickdown-wav')[0];
$(document).delegate('a','click',function() {
ClickDown.play();
});
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.
Q: Is there a source code only solution to playing sounds from JavaScript? Clickdown.wav is only 1k.
On iOS, there is no preloading. This was done by Apple on purpose, so that the user wouldn't have to use unnecessary bandwidth.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With