Friday Discount - Lifetime Access for $20!!!! - Click Here!

Adding a Playlist of Music to Your Levels

In the Platform Games tvOS and iOS Starter Kit

As of Build 1.2, you can now include a playlist of MP3’s in your app. Each level can choose an initial MP3 to play, but users can pause the game to skip to another track (by pressing / tapping Right) or turn off the music (by pressing / tapping Left). Lets start by looking at the array of mp3 files…

playing mp3 files in the tvos iOS Starter Kit

In the Root of the property list, an Array named MP3List defines each track name (including the extension .mp3). Notice in the example above we’ve included spaces in the filename, and written a very descriptive track name. This is notable, because you can include a label in your scene named TrackCredit which will show whatever is written in your file’s title (not including the .mp3 of course).  This will only appear when the game is paused. The demo level in the kit already includes this setup, so all you really need to do is define the tracks in the MP3List. Including the track title and artist in the file name might be important if you use free music that requires an attribution license (which means the artist is giving away the music to use, but simply wants credit for it).

playing mp3 files in the tvos iOS Starter Kit 2

If you don’t want to credit the artist or show a track title at all, simply remove the TrackCredit label, or hide it off screen by moving the TrackCreditPlaceholder node from where it is currently at.

Track Credit Placeholder

 

Starting a Level with a Specific Track

Use the PlayMp3FromList property in each level dictionary to define which track in the list will play. For example, setting 0 would play the first track, 1 would play the second and so on.

Setting Tracks

 




Know what an affiliate program is? You make money just by sharing links to our site! Win. Win.

Earn when you refer any buyer here! 30 day tracking. Commissions are 33%-50% and recur on subscription products!