Reputation: 161
According to the SoundCloud API Guide, I can play sounds from SoundCloud on a web page or web application, without using the embedded player (example code below):
<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/136405212&color=ff5500&auto_play=false&hide_related=false&show_artwork=true&show_comments=true&show_user=true&show_reposts=false"></iframe>
I want to try and play SoundCloud assets without this embed; instead, I want to find out how to:
onLoad
")Any help with this, including anything that can use JavaScript and/or jQuery, will be much appreciated.
Yep, you can also play sounds from your application. Depending on your needs, you can embed a player widget, use the JavaScript SDK to stream audio content in the browser, or feed a stream url into your own audio player. You can also use our Widget API to control the player and handle events. (from http://developers.soundcloud.com/docs/api/guide#playing)
Upvotes: 1
Views: 3933
Reputation: 17168
Expanding on @Marco's answer:
var xhr = new XMLHttpRequest(),
stream = new Audio(),
client_id = '?client_id=d4ab52d80ed2e7790c3a243495b30093';
xhr.open('GET', 'http://api.soundcloud.com/tracks/136405212.json' + client_id);
xhr.onload = function(){
var track = JSON.parse(xhr.responseText);
stream.src = track.stream_url + client_id;
stream.play();
};
xhr.send();
Upvotes: 9
Reputation: 634
You can try SoundCloud's JavaScript API for streaming tracks and other stuff.
Upvotes: 2