FreeStreamer
FreeStreamer copied to clipboard
Problems with HTTP 302 redirect
I'm using FreeStreamer 3.1.1 in my iOS app and so far I've been quite happy with it. However, I've run into a problem streaming certain Soundcloud tracks. The following works fine from the command line (with CLIENT_ID replaced by your Soundcloud API client ID).
curl -vIL 'https://api.soundcloud.com/tracks/254706279/stream?client_id=CLIENT_ID'
It shows the location of the mp3 (in the first 302 response) to be streamed and if I copy-paste and hardcode that URL into my app, FreeStreamer can open and play it without a problem. However, if I use the original URL, I'm getting
FSAudioStream: Network error: HTTP response code 401 [FreeStreamer 3.1.1] URL: https://api.soundcloud.com/tracks/254706279/stream?client_id=CLIENT_ID
This isn't true for every URL. FreeStreamer doesn't complain about the 302 redirect happening with this URL https://api.soundcloud.com/tracks/247134849/stream?client_id=CLIENT_ID
and plays it fine.
Any ideas what's wrong? My ugly workaround is to perform a HEAD operation just to get the Location header :(
Same problem here with javascript SDK and this url
var promise = SC.get('/resolve', { url: 'https://soundcloud.com/lifeofdesiigner/desiigner-panda' });
promise.then(function (track) { SC.stream('/tracks/' + track.id).then(function (player) { }); });
Some tracks work others don't. But I see in the first request the 302 found
i was facing this same issue and ended up using a pretty nasty workaround. I added libcurl to my app and curl for the url to see if it's a 302 redirect. If so, then I use the 302 redirected Location header url instead of the original url. Weird workaround but it worked for me trying to get through a deadline.
hey buddy ,can you show me the code? thanks