我有一个页面使用SoundCloud js sdk来传输音频。初始化如下所示:
SC.initialize({
client_id: myId,
redirect_uri: "https://" + window.location.host + "/soundcloud-callback"
});
该页面使用SC.whenStreamingReady
,SC.get
和SC.stream
,其方式与以下内容相同:
// Wait for SoundManager
SC.whenStreamingReady(function() {
soundManager.onready(function() {
// Get track metadata and stream the track itself
SC.get("https://api.soundcloud.com/tracks/" + audioId, function(data) {
SC.stream(data.stream_url, {...});
});
});
});
问题是SC.stream
请求https页面("https://api.soundcloud.com/tracks/" + audioId + "/stream"
),但是302被重定向到http页面(http://ec-media.soundcloud.com/...)。音频仍然可以工作,但我的浏览器栏中没有令人满意的锁定(这一个请求是阻止它的唯一因素)。
我做错了吗?
答案 0 :(得分:1)
现在已经修复了。
尝试从https
导航到随机曲目 https://api.soundcloud.com/tracks/82686108/stream?client_id=YOUR_CLIENT_ID
// will redirect you to
https://ec-media.soundcloud.com/SQyhrPCMQJyQ.128.mp3?%some_uuid%&AWSAccessKeyId=%amazon_access_key%&Expires=%expires%&Signature=%siganture%
并使用http
http://api.soundcloud.com/tracks/82686108/stream?client_id=YOUR_CLIENT_ID
// will redirect you to
http://ec-media.soundcloud.com/SQyhrPCMQJyQ.128.mp3?%some_uuid%&AWSAccessKeyId=%amazon_access_key%&Expires=%expires%&Signature=%siganture%