Clone Audio object

audio, html, javascript

Solution

I had exactly the same predicament as originally raised. The following worked perfectly well for me :

var audio2 = audio.cloneNode();

Problem

I am aware of how to clone an object, but I'm wondering, how do I clone an audio object? Should I clone it differently than I would clone an object? To "illustrate" what I mean: ``` var audio = new Audio("file.mp3"); var audio2 = $.extend({}, audio); // Clones `audio` ``` Is this the correct way to do this? Reason why I'm asking this is that I want to be able to play the same sound multiple times simultaneously.

Original source