Ajax-loader-large-white
Using the SoundCloud API
Initializing the JavaScript SDK

SoundCloud is a social sound platform
that gives users unprecedented access to the world’s largest community of music and audio creators. With unmuting the web as its continued ambition, SoundCloud allows everyone to discover original music and audio, connect with each other and share their sounds with the world. In addition, sound creators can use the platform to instantly record, upload and share sounds across the internet.

The SoundCloud API allows you to build applications that take advantage of all of the functionality offered by the SoundCloud platform. It is based on making HTTP requests to a set of endpoint URLs to request information and perform actions on behalf of users. We provide a number of SDKs that make this super easy to do. In this exercise we'll get started with the JavaScript SDK which allows you to build rich, client-side applications that use the SoundCloud API.

Before you start using the JavaScript SDK, you must let your application know where to find it by adding a script tag to your HTML document. You also need to initialize the SDK with an id that identifies your application to us. Normally you would get a client id by registering your application at the SoundCloud website, but in these lessons we will use YOUR_CLIENT_ID.

Instructions

In the editor to the right, there's a tab called index.html.

  1. Go to line 4 and add a <script></script> element.
  2. Make the src attribute equal "//connect.soundcloud.com/sdk.js".

Next, click on the tab called script.js. Because you added the above script tag, we can now use the SC object.

  1. Call the initialize method on the SC object passing it an object with a single property: client_id. The value of the property will be 'YOUR_CLIENT_ID'.
  2. Hit Save & Submit Code.
index.html
script.js
project
View Preview