Updates to the SoundCloud AS3 API

During the last week I made some improvements to the SoundCloud AS3 API library:

  • Full ASDoc documentation is now available online
  • Uploaded an example file for Flash CS4
  • API is now prepared for scenarios where you want to automatically get an access token after authentication (I’ll do an extra post on this in the next days)
  • Added support for requests to public resources without having to authenticate first

I should say a few words about the last point: If you want to build a simple audio player app like Citysounds (check it out, great stuff!) that only accesses public resources, chances are you don’t have to deal with OAuth authentication at all.

For example, the code to access the public tracks of  a specific SoundCloud user looks like this:

var scClient:SoundcloudClient = new SoundcloudClient("yourConsumerKey", "yourConsumerSecret");

var delegate:SoundcloudDelegate = scClient.sendRequest("users/anyUserName/tracks", "GET");

delegate.addEventListener(SoundcloudEvent.REQUEST_COMPLETE, requestCompleteHandler);

protected function requestCompleteHandler(event:SoundcloudEvent):void
  var trackList:XML = event.data as XML;


This will give you a list of tracks in XML format with all properties like track title, URL and so on. You can then pick a track from the list and start playing the MP3 with the Sound class. Yes, it’s that simple! ;)

But as soon as you want to access private tracks or want to do write operations like  updating a user profile or uploading a track, you’ll need to go through the OAuth authentication process. Check the Quickstart Tutorial to see how this works.

UPDATE (05/17/2010)

SoundCloud is about to change the policy for accessing public resources via their API. They will soon require a consumer key and secret for all calls, no matter whether you use OAuth or not. They had already implemented that on the sandbox server on friday, pulled it back today, but plan to roll it out again on sandbox later this week. Anyway, it looks like you should prepare your app for this change as soon as possible. I just changed the example above to include “yourConsumerKey” and “yourConsumerSecret” in the constructor of the SoundcloudClient.

The bottom line is that you need to register your app with SoundCloud in any case now. But you don’t need to get an update of the Soundcloud-AS3-API files. And if you’re using OAuth, nothing changes at all for you.

You can find a detailed guide on how to register your app and use the app key and secret codes in the Github-Wiki (you can skip the authentication steps 4 – 6 if you don’t use OAuth).

Read more about this update in the SoundCloud API Google Group