soundcloud
2014-06-06 33 views 0 likes 
0

我想用HTML5标记播放声音。SoundCloud API - 如何使用HTML5播放私人声音<audio>标记

的源代码如下所示:

SC.get("/tracks/153068147", {}, function(sound, error) { 
    $('#player').attr('src', sound.stream_url + '?client_id=' + client_id); 
    }); 

当我设置的声音是公开的,它工作得很好。但是,当我将它设置为私人时,它不起作用。问题是什么?

顺便说一下,我还使用SC.connect验证了我的APP,然后再播放它。声音也与我的SoundCloud帐户一起上传。

回答

0

需要更换HTTP到HTTPS,并在网址 所以加user_auth_token:

`$('#player').attr('src', sound.stream_url.replace('http:','https:') + '?client_id=' + client_id+'&oauth_token=' + oAuthToken);` 
+0

是的,我能理解user_auth_token可能是专用轨道很有帮助。但是,我怎样才能得到与JS SDK API的令牌。 – Lancer

+0

好的,我是通过SC.accessToken()得到的,Thx〜 – Lancer

相关问题