Reputation: 4912
http://jsfiddle.net/bej28cts/
https://developers.soundcloud.com/docs/api/guide#playing
So I'm following soundcloud's documentation to play a song, but I still can't get any music to play.
Here is a bare bones version of my app:
HTML:
<button onclick="start()">Click me</button>
JS:
SC.initialize({
client_id: '44c88b31e709231ae8f61adc66908de3'
});
function start() {
// stream track id 293
SC.stream('/tracks/293').then(function (player) {
player.play();
});
}
I can't seem to hear any music. Any tips to fix this?
Upvotes: 0
Views: 99
Reputation: 13211
Your Code and your example works! I am using Edge.
EDIT: It's working in Internet Explorer and Firefox as well! Chrome does not play it and does not show any error.
Maybe you should the complete code from the documentation:
<script src="https://connect.soundcloud.com/sdk/sdk-3.0.0.js"></script>
<script>
SC.initialize({
client_id: 'YOUR_CLIENT_ID',
redirect_uri: 'http://example.com/callback'
});
// initiate auth popup
SC.connect().then(function() {
return SC.get('/me');
}).then(function(me) {
alert('Hello, ' + me.username);
});
</script>
Upvotes: 2