16

Click here to load reader

SoundCloud API Integration - With your Website & Mobile Apps

Embed Size (px)

Citation preview

Page 1: SoundCloud API Integration - With your Website & Mobile Apps

SoundCloud API IntegrationHow to Guide

www.letsnurture.com

Page 2: SoundCloud API Integration - With your Website & Mobile Apps

Initial Setup

www.letsnurture.com

Page 3: SoundCloud API Integration - With your Website & Mobile Apps

SoundCloud Connect <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script><script src="https://connect.soundcloud.com/sdk-2.0.0.js"></script><script> SC.initialize({

client_id: "Your client ID",redirect_uri: "http://letsnurture.co.uk/demo/soundcloud/callback.html"

}); $("#connect").live("click", function(){

SC.connect(function(){ SC.get("/me", function(me){ $("#username").text(me.username); $(#description").val(me.description); });

}); });

www.letsnurture.com

Page 4: SoundCloud API Integration - With your Website & Mobile Apps

Update Method

$("#update").live("click", function(){SC.put("/me", {user: {description: $("#description").val()}},

function(response, error){ if(error){ alert("Some error occured: " + error.message); }else{ alert("Profile description updated!"); }

}); });</script>

www.letsnurture.com

Page 5: SoundCloud API Integration - With your Website & Mobile Apps

callback.html(While you are connecting)

<!DOCTYPE html>

<html lang="en">

<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Connecting with SoundCloud</title>

</head> <body onload="window.opener.setTimeout(window.opener.SC.connectCallback, 1)">

<b style="width: 100%; text-align: center;">Loading Details</b> </body>

</html>

www.letsnurture.com

Page 6: SoundCloud API Integration - With your Website & Mobile Apps

Sign In with SoundCloudClient-side JavaScript Applications

Server-side Web Applications

Refreshing Tokens

Mobile and Desktop Applications

Getting Information about the Authenticated User

What Next…..?

www.letsnurture.com

Page 7: SoundCloud API Integration - With your Website & Mobile Apps

I am Logged In Now WhatUpload Audio Files

Uploading Meta Data

Sharing on Social Networks

Creating Playlists(Set)

Adding Files to Playlists

Contributing a Sound to a Group

www.letsnurture.com

Page 8: SoundCloud API Integration - With your Website & Mobile Apps

SoundCloud Where is the Sound

Playing Sounds

Embedding a SoundCloud Widget

Streaming Sounds

Comments

Follow & Like

Search

Paging

www.letsnurture.com

Page 9: SoundCloud API Integration - With your Website & Mobile Apps

HTTP API Reference

● /connect● /oauth2/token● /users● /tracks● /playlists● /groups● /comments● /me● /me/connections● /me/activities● /apps● /resolve● /oembed

www.letsnurture.com

Page 10: SoundCloud API Integration - With your Website & Mobile Apps

SC.Connect

$("#connect").live("click", function(){SC.connect(function(){

SC.get("/me", function(me){ $("#username").text(me.username); $("#description").val(me.description); });

}); });

www.letsnurture.com

Page 11: SoundCloud API Integration - With your Website & Mobile Apps

SC.put

$("#update").live("click", function(){SC.put("/me", {user: {description: $("#description").val()}},

function(response, error){ if(error){ alert("Oops error occured: " + error.message); }else{ alert("Your Profile description updated!"); }

}); });

www.letsnurture.com

Page 12: SoundCloud API Integration - With your Website & Mobile Apps

SC.get

$("#loadTracks").live("click", function(){SC.get("/tracks", {limit: 1}, function(tracks){

var track = tracks[0]; SC.oEmbed(track.uri, document.getElementById("track"));

}); });

www.letsnurture.com

Page 13: SoundCloud API Integration - With your Website & Mobile Apps

SC.stream

$("#stream").live("click", function(){

SC.stream("/tracks/146702157", {autoPlay: true});

});

www.letsnurture.com

Page 14: SoundCloud API Integration - With your Website & Mobile Apps

Lets Record and Upload

<script src="https://connect.soundcloud.com/sdk-2.0.0.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script><script>

SC.initialize({client_id: "f9a66e202627c576a589038c9c996009",redirect_uri: "http://letsnurture.co.uk/demo/soundcloud/callback.html"

});

SC.connect(function() { SC.record({

start: function() { window.setTimeout(function() { SC.recordStop(); SC.recordUpload({ track: { title: 'My First SoundCloud Recording } }); }, 5000);

} });});

</script>www.letsnurture.com

Page 15: SoundCloud API Integration - With your Website & Mobile Apps

Demo Time

ConnectME

Get HOT Trackletsnurture.co.uk/demo/soundcloud/callback.html

www.letsnurture.com

Page 16: SoundCloud API Integration - With your Website & Mobile Apps

For SoundCloud/Spotify Integration with your Web/App

Contact: [email protected]

www.letsnurture.com