Updated: There was a mistake in the call to initiate a new track. It has been corrected below.

So, you want to build a cool music hack, site or app and the idea of having to interface with a bunch of different music sources keeps you awake at night? Well, we now have you covered with a really simple multi-source music API that rids you of all the music fulfillment headaches and lets you focus on building your awesome app “that just plays” for virtually all of your users regardless of who their preferred provider is.

http://toma.hk/api.html

Simply paste in a link to our js file, then you are ready to go.

To initiate a new track:

var track = window.tomahkAPI.Track(TRACK_TITLE, ARTIST_TITLE, options)

Where your options are:

  • width = width of the player (in pixels)
  • height = height of player (in pixels)
  • handlers = the event handlers for you to decide what to do and when
Note: you could just hide the Toma.hk embedded player in a <div> if you didn’t want it visible - although you should disable YouTube if you do so.

And finally, you need to render the track onto the page.

document.getElementById("parent_container”).appendChild(track.render())

Sources currently leveraged include SoundCloud, Official.fm, Last.fm, Deezer, Jamendo, YouTube, Rdio and Spotify - with more on the way. If you users have already set their source preferences and priorities on Toma.hk then those will travel with them to your apps.

  1. tomahawkplayer posted this