简体   繁体   中英

Can't stream some of SoundCloud's tracks

I'm having issues streaming a small number of tracks from SoundCloud.

I am using AVPlayer/AVPlayerItem to stream the SoundCloud tracks, which has worked perfectly with most of SoundCloud's tracks, but recently some of the newer SoundCloud tracks won't play. I've tried listening to all the AVPlayerItem notifications, and none of them report an error.

I've also tried using MPMoviePlayerViewController and MPMoviePlayerController to stream these tracks. They can play the other tracks just fine, but also are unable to play these select few.

I've even tried playing them in my computer's browser. With the working tracks, I get an in-browser audio player, and the track starts streaming. When I try the problematic tracks, nothing happens - no in-browser audio player, and no audio streaming of any kind. When I go to view source, I also see nothing.

My initial assumption was that these streams are empty, or somehow not working, but when I try playing the same tracks through SoundCloud's iOS app, they play just fine. This suggests there's a way to get this working, but they might have access to streaming url's that work better and are not distributed through the public API.

Here's an example of a track that won't work in my app: http://soundcloud.com/cyrilhahn/cyril-hahn-javeon-breaking

Here's the api call to that track: http://api.soundcloud.com/tracks/132839787?client_id=YOUR_CLIENT_ID

(Apologies for any inconvenience, but you'll need to fill in YOUR_CLIENT_ID with a valid SoundCloud api client id, I can't provide mine.)

Which includes a 'stream-url' key with the following url to stream the track (sorry, I had to abbreviate the following link because I can only post 2 links, due to having 0 reputation): ...com/tracks/132839787/stream?client_id=YOUR_CLIENT_ID

The API call to the track even includes a 'streamable' key, which is saying 'true'.

Because the native iOS classes I've tried using to stream this aren't reporting any errors, I'm really not sure what to go by. The only thing someone mentioned to me was that those tracks might be RTMP streams, which iOS doesn't support.

Here's another stackoverflow post which has a similar and possibly relevant question, but no responses yet: SoundCloud track.stream_url not working for some of the tracks

As you suggested, the reason the stream url doesn't for all tracks is because some tracks exclusively use (RTMP/HLS) for streaming.

SoundCloud's in the progress of updating the SDKs and documentation for this, but this means that the Cocoa SDK isn't updated yet. I'm not sure if there's any API changes planned to reflect the streaming type, but I've mentioned the issue in the team.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM