Once you have integrated the Jukebox plug-in into your game project, and created one or more Jukebox playlists, you are now ready to connect everything up to start getting streamed Jukebox music playing in your game.

The most basic steps to do this are as follows:

  1. Add an Audio Source to your scene. You can do this in the Unity IDE by selecting an appropriate parent object in the Hierarchy browser window, right-clicking it, and then selecting GameObject->Audio->Audio Source, as shown below: 
  2. Add a Jukebox Playlist script to your scene – either attached to the Audio Source, the Main Camera; or another scene component. Assuming you’re adding the script to the camera, select the Main Camera object in the Hierarchy browser window, and then click the ‘Add Component’ button in the Inspector window. Scroll down through the list of components, and select Scripts->Jukebox Playlist.
  3. In the Jukebox Playlist’s properties box, assign your freshly created Audio Source as the Playlist’s Audio Source property.
  4. Also in the Jukebox Playlist’s properties box, paste a Playlist Token, as created here, into the Playlist’s Playlist Token property edit box. The result of steps 3 and 4 is shown below: 

There, that’s it! Click the Play button in the Unity IDE and you should hear your playlist playing out within your game environment.

Once you have basic playback working, the final step, to ensure a high-quality user-experience, is to plumb in the Jukebox UI features to enable your game to display track information, and to allow the user to control audio playback and give preference feedback. Please see the following section for information on how to do this:

Going a Bit Deeper…

The above set of steps was slightly over-simplified. The key concept to understand is that a Jukebox Playlist must be connected to a Unity Audio Source in order to stream its audio data into the game environment. Once you have achieved this step, then you can use the Audio Source like any other (with one extra consideration* – see the next paragraph). See the Unity Development Manual for more information on what is possible with Audio Sources.

*It is recommended that you use a Jukebox.IControl component in your scene in order to obtain information about the current track, give your user control over the music they are listening to; and to switch correctly between playlists, in the case that you have declared more than one. See here for more information on how to do this.

The Jukebox Playlist script exposes the Jukebox.IPlaylist interface through an easy-to-use wrapper. You may use this script as-is; but you are also free to modify or replace it to use the interface directly. Please consult the Jukebox.IPlaylist API docs for more information on how to do this.