Click here to load reader
Upload
ketan-raval
View
486
Download
0
Embed Size (px)
Citation preview
SoundCloud API IntegrationHow to Guide
www.letsnurture.com
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
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
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
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
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
SoundCloud Where is the Sound
Playing Sounds
Embedding a SoundCloud Widget
Streaming Sounds
Comments
Follow & Like
Search
Paging
www.letsnurture.com
HTTP API Reference
● /connect● /oauth2/token● /users● /tracks● /playlists● /groups● /comments● /me● /me/connections● /me/activities● /apps● /resolve● /oembed
www.letsnurture.com
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
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
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
SC.stream
$("#stream").live("click", function(){
SC.stream("/tracks/146702157", {autoPlay: true});
});
www.letsnurture.com
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
Demo Time
ConnectME
Get HOT Trackletsnurture.co.uk/demo/soundcloud/callback.html
www.letsnurture.com