I am creating a game using HTML5 audio. Some sounds can be played several times at the same time (polyphony), so instead of using the original <audio> elements, I save the links to them in the object, and then play them as follows:
playSound(id) { this.sounds[id].cloneNode().play(); }
My question is: will the cloned node collect garbage automatically, or do I need to worry about it? At least in Chrome, the sound will play, so the node will not be deleted immediately after the function exits, but since the node is not inserted into the DOM and I donβt have a link to it, I canβt check if it is deleted from the memory after the sound has finished playing.
source share