Audio Playing Badly when Online <p>I've created this game using Javascript, and I play all sounds (including effects and background music) using the Audio type. It works perfectly when I run the page from my computer, but after I uploaded on my host and tried to run from the web, it started to sounds really terrible: sometimes it is delayed, sometimes it does not play at all.</p> <p>I've noticed that the main problem is related to playing the same audio more than once in a short amount of time: it plays a shooting sound whenever the user clicks on the page, so usually it isn't that bad when they're not spamming their mouse, but once you start clicking many times the sounds turns out terrible. </p> <p>The audio file for that particular sound is very short, and when running from my computer is has no problem even when the user is clicking very fast. Here is what the function does:</p> <pre><code>function play(aux,volume){ if(volume == undefined) volume = 1; if(!sound){return;} aux.volume = globalVolume * aux.customVolume * volume; aux.load(); aux.play(); } </code></pre> <p>So, pretty much, what it does is loading and playing the sound again whenever that function is called. That was made so it would start again even if the the function is called while the sound was still going on.</p> <p>Again, this whole things works smoothly when running from my computer, but from the web it just sucks.</p> <p>Q: Does anyone knows how to fix this? Or does anyone know an alternative I could use to make it work?</p> <p>Suggestions are welcome as well.</p>