function
youdj.loadsong (deckid, url, title, autoplay)
description : allows to load a MP3 file into the mixer
deckid <int> : deck number you want to load the mp3 in, must be equal to 1 (left deck) or 2 (right deck)
url <string> : absolute url of the MP3 file you want to load
title <string> : title to display for this file
autoplay <boolean> : set to true if you want this file to autoplay
youdj.loadsong(1, "https://yoursite.com/music/song.mp3", "This is an example song", true);
A note about the MP3 files
The MP3 files must be located on the same domain than the YouDJ mixer. Also cross-domain policy (CORS) must be enabled on this domain, meaning the HTTP response header must have Access-Control-Allow-Origin set to *.
Click here to enable CORS on your server.
function
youdj.automix (enable)
description : allows to programmically turn on or off the automix mode
enable <boolean> : true to activate the automix, false to desactivate it
youdj.automix(true);
event
youdj.onready = function(version)
description : this event is triggered when the YouDJ mixer is loaded and ready. You must wait for this event before loading a song.
version <string> : the version of the YouDJ mixer
youdj.onready = function(version) { /* start sending commands to YouDJ */ } ;
event
youdj.oninfo = function(deckinfo1, deckinfo2)
description : this event is triggered 20 times per seconds and return the decks playback state such as the bpm, position, volume...
deckinfo1 <object> : the playback state of the deck 1 (left deck)
deckinfo2 <object> : the playback state of the deck 2 (right deck)
youdj.oninfo = function(deckinfo1,deckinfo2) { console.log("deck1 BPM = ", deckinfo1.bpm); } ;
event
youdj.onrequest = function(deckid)
description : when automix mode is enabled, this event is triggered when the YouDJ mixer needs a new song to be loaded. You are in charge to select and load the next song. In means that you can implement any kind of algorithm for generating the automix playlist.
deckid <int> : deck number which requests a new mp3 to be loaded, must be equal to 1 (left deck) or 2 (right deck)
youdj.onrequest = function(deckid) { youdj.loadsong(deckid, "https://.../newsong.mp3", "New song", false); } ;