Having
var audio = new Audio("click.ogg")
I play the click sound when needed by
audio.play()
However, sometimes user is so fast that a browser does not play the audio at all (probably when still playing a previous play
request). Is this issue related to preload?
How can I force a browser to stop playing and start over? There is no stop
, just pause
in HTML5 audio component, correct? What workaround can be used here?
Update - Additional note:
I have multiple checkbox-like div
elements with a touchend
event. When such event is triggered, the elements visually change, a sound is played and an internal variable is set accordingly. If user tap on these elements slowly, everything works nicely. If tap fast, the sound is often completely skipped...