The usual way of creating an audio player in JavaScript
var a = new Audio();
a.src = "test.mp3";
assumes the audio data is owned by the Audio
object. What is the proper way to load audio data separately, and then create audio players which would play that existing data? One use-case is when you want to play the same sound simultaneously by multiple players, e.g. to create an echo effect. I would assume that to create another player using same data one can just do
var b = new Audio();
b.src = a.src;
but I wonder whether this is the best way to do it... and if it is, whether one would have to wait for loadeddata
/canplaythrough
events on b
given those events had already fired on a
.