阅读背景:

如何播放SoundCloud RTMP流?

来源:互联网 

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.

我正在使用SoundCloud公共API在带有JavaScript SDK 3.0.0的SC服务器的浏览器中播放音频。初始化之后,我设法使用SC.Stream方法获取具有特定轨道的流URL的JSON。

{  
   "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?

其中,有一个HTTP,一个HLS和一个RTMP URL。我可以处理HTTP,但我无法使RTMP正常工作。有谁知道如何决定播放哪个流?我怎么能操纵这个呢?或者我如何访问RTMP流?

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.

几个星期前,我用WireShark检查了SoundCloud是通过RTMP传送的,但是现在我似乎无法捕获任何RTMP流,而且我不知道如何搜索它。

2 个解决方案

#1


0  

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

通常,RTMP流用于Flash Media Server,Wowza Media Server和Red5服务器。您可以使用网页中的flash对象播放该类型的流,例如:在此处输入链接描述

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

或者对于应用程序 - 您可以使用ffplay播放并使​​用ffmpeg转换为其他类型的流

#2


0  

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:

我一直在做同样的事情。它在开发模式下使用HTTP协议播放,然后恢复为在正常浏览模式下尝试使用RTMP协议(至少在chrome中)。以下是我解决问题的方法..当您使用sc.stream请求时,它将返回要播放的对象。您可以在将此对象发送到播放器之前对其进行编辑。例如:

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.

如上所述设置协议对象参数会强制它使用正确的协议,如果您通过尝试在非开发模式下播放轨道来首先登录它,您将看到它还包含[“rtmp”]协议,然后失败玩镀铬。


分享到: