0
votes

I'm using the SoundCloud public API for playing audio in a browser from the SC servers with the JavaScript SDK 3.0.0. After initialization, I managed to get a JSON with a specific track's stream URLs with the SC.Stream method.

{  
   "http_mp3_128_url":"https://cf-media.sndcdn.com/a6QC6Zg3YpKz.128.mp3...” ,
   "hls_mp3_128_url":"htt...//ec-hls-media.soundcloud.com/playlist/a6QC6Zg3YpKz.128.mp3/...” ,
   "rtmp_mp3_128_url":"rtmp://ec-rtmp-media.soundcloud.com/mp3:a6QC6Zg3YpKz.128?...",
   "preview_mp3_128_url":"htt....../ec-preview-media.sndcdn.com/preview/0/90/a6QC6Zg3YpKz.128.mp3?..."
}

In it, there is an HTTP, an HLS and an RTMP URL. I can handle the HTTP, but I can't get the RTMP working. Does anyone know how is it decided which stream will be played? And how can I manipulate this? Or how can I access the RTMP stream?

A few weeks ago I checked with WireShark that SoundCloud delivered via RTMP, but now I can't seem to capture any RTMP streams, and I don't know how to search for one.

2
Are you asking how to build an RTMP stream player? If so, this question is too broad. If you're asking for an off-site resource, such as a library, to play RTMP streams, that question is off-topic as well.JAL
You mention that you can't get the RTMP working; could you show the code for that? It's hard to help you when we have to guess at what you wrote.Mogsdad

2 Answers

0
votes

Usually RTMP stream is used from Flash Media Server, Wowza Media Server and Red5 server. You can play that type of stream using a flash object in your web page like: enter link description here

Or for application - you can play with ffplay and convert to other type of stream with ffmpeg

0
votes

I've been working on the same thing. It plays using the HTTP protocol in Dev mode and then reverts to attempting to use the RTMP protocol in normal browsing mode (at least in chrome anyway). Here's how I solved the issue.. When you use the sc.stream request it will return the object to play. You can edit this object before it gets sent to the player. For example:

SC.stream('/tracks/'+playr.currentTrack.id).then(function (x) {

x.options.protocols=["http"];

x.play();}

Setting the protocol object parameter as above forces it to use the correct protocol, if you console log it first by trying to play the track in non-dev mode you'll see it also contains the ["rtmp"] protocol, and then fails to play in chrome.