Play audio in javascript with a good performance
- by João
I'm developing a browser game where the player can shoot. Everytime he shoots it play a sound.
Currently i'm using this code to play sounds in JavaScript:
var audio = document.createElement("audio");
audio.src = "my_sound.mp3";
audio.play();
I'm worried about performance here. Will 10 simultaneous sounds impact my game performance too much?
Will all audio objects stay in memory even after they are played?