问题
I have a page using the SoundCloud js sdk to stream audio. The initialization looks like this:
SC.initialize({
client_id: myId,
redirect_uri: "https://" + window.location.host + "/soundcloud-callback"
});
The page uses SC.whenStreamingReady
, SC.get
and SC.stream
in a way equivalent to the following:
// 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, {...});
});
});
});
The problem is that SC.stream
requests an https page ("https://api.soundcloud.com/tracks/" + audioId + "/stream"
) but is 302 redirected to an http page (http://ec-media.soundcloud.com/...). Audio still works, but I don't get a satisfying lock in my browser bar (and this one request is the only thing stopping that).
Am I doing something wrong?
回答1:
This has been fixed now.
Try navigating to a random track from 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%
And with 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%
来源:https://stackoverflow.com/questions/15305674/soundcloud-redirects-https-http