I\'m using this code to play a preloaded mp3 file.
var shuffle = $(\"#shuffle\")[0];
shuffle.play();
Shuffle is my id. I got the code o
In the direct context of your question, $("#shuffle")
is a selector of an id, which returns a jQuery
object (not an array per-se, but it has an array-like structure), then the [0]
part is actually returning a native DOMElement
object of the element with id shuffle
instead of the jQuery
object returned by calling $('#shuffle')
(without the []
).
Essentially the same as doing document.getElementById('shuffle')
EDIT (as Matt pointed out)
this will then allow you to do your .play()
call to start your audio stream.