Skip to content

Instantly share code, notes, and snippets.

@eric-wieser
Created June 28, 2012 16:47
Show Gist options
  • Save eric-wieser/3012439 to your computer and use it in GitHub Desktop.
Save eric-wieser/3012439 to your computer and use it in GitHub Desktop.
if(location.search == "?music") {
//Do music!
var clientId = "dd250c3d9ef318565e6f22e871b87fb8";
var musicUrl = "http://soundcloud.com/alex-nicholls/snakes-theme";
$.getJSON(
'http://api.soundcloud.com/resolve.json?callback=?', {
url: musicUrl,
client_id: clientId
}, function(data) {
if(data.streamable && data.stream_url) {
var music = new Audio();
music.src = data.stream_url+'?client_id='+clientId;
music.play();
}
}
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment