SoundCloud for Developers

Discover, connect and build

We use cookies for various purposes including analytics and personalized marketing. By continuing to use the service, you agree to our use of cookies as described in the Cookie Policy.

Migrating to JavaScript SDK 3.0.0

Version 3.0.0 represents a major technical change for the SDK and is not backwards compatible with version 2.0.0. Migrating to the new version should be pretty straight forward, though.

To upgrade to the SoundCloud JavaScript SDK version 3.0.0, replace all references to:


JavaScript Promises

All SDK methods now return Promises instead of providing a way to pass callbacks.

SC.get('/me', function (user, error) {
  if (error) {
    alert('There was an error ' + error.message);
  } else {
    alert('Hello ' + user.username);

Now becomes:

SC.get('/me').then(function (user) {
  alert('Hello ' + user.username);
}).catch(function (error) {
  alert('There was an error ' + error.message);

Instead of handling the error- and the success-case in the callback, there are two different functions that will handle the cases. The then method allows you to chain several API methods together, so that you don't need to handle error cases all over the place:

SC.put('/me', {
  user: { description: 'I am using the SoundCloud API!' }
  return SC.get('/me');
  alert('Error: ' + error.message);

This not only applies to HTTP methods, but also to the callbacks that you could provide to the old SC.oEmbed, SC.recordUpload, SC.recordPlay, and SC.connect methods. They now all return promises that will be resolved with the requested information.

New Recorder

The recorder methods are no longer tied to the global SC object. We refactored the recorder to become an independent object. This means that you can no longer use the methods SC.record, SC.recordStop, SC.recordPlay and SC.recordUpload.

All those methods (and now even more) are still available on the new recorder object. Check the SDK documentation on how to use the recorder now: SC.Recorder documentation.

var recorder = new SC.Recorder();

}, 5000);

New Player

The SDK comes with a new, more stable player. All player methods are still the same (we only got rid of ontimedcomments). However, since we now embed the player code into the SDK, there is no need for SC.whenStreamingReady anymore. Check out the Player documentation to see all available methods and events. Also check out the new documentation to see how to instantiate a player.

Old SDK versions

The old SDK versions will stay online but we will no longer provide support for them.


If you have any questions about this upgrade, please feel free create an issue in our [Github repository](