问题
I would like to play sound with HTML5 tag.
The sourcecode is shown as below:
SC.get("/tracks/153068147", {}, function(sound, error) {
$('#player').attr('src', sound.stream_url + '?client_id=' + client_id);
});
When I set the sound to be public, it works well. But when I set it to be private, it does not work. What is the problem?
By the way, I also authenticated my APP with SC.connect before I play it. And the sound is also uploaded with my SoundCloud account.
回答1:
you need to replace http to https and add user_auth_token in the url so:
`$('#player').attr('src', sound.stream_url.replace('http:','https:') + '?client_id=' + client_id+'&oauth_token=' + oAuthToken);`
来源:https://stackoverflow.com/questions/24076885/soundcloud-api-how-to-play-private-sound-with-html5-audio-tag