如何使用libstreaming在rtsp中发送多播音频并在vlc播放器中接收它

时间:2015-07-07 06:27:50

标签: android android-studio vlc libstreaming

Uni cast在我的代码和vlc上工作正常。

图书馆来源在这里:https://github.com/fyhertz/libstreaming

通过多播,  当前代码在启动RTSP服务器时提供如下输出

Transport: RTP/AVP/UDP;multicast;destination=232.0.1.2;client_port=5004-5005;server_port=56203-60523;ssrc=eacf345e;mode=play

但是当我尝试使用vlc连接到rtsp时,vlc连接但没有给出任何输出(即:audio)。我给这个链接到vlc“rtsp://192.168.1.115:1234”。 “192.168.1.115”是我的Android设备服务器的IP地址。 我目前的代码是:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_main);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

mSurfaceView = (SurfaceView) findViewById(R.id.surface);

// Sets the port of the RTSP server to 1234
Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
editor.putString(RtspServer.KEY_PORT, String.valueOf(1234));
editor.commit();

// Configures the SessionBuilder
SessionBuilder.getInstance()
.setSurfaceView(mSurfaceView)
.setPreviewOrientation(90)
.setContext(getApplicationContext())
.setAudioEncoder(SessionBuilder.AUDIO_AAC)
.setVideoEncoder(SessionBuilder.VIDEO_NONE)
.setDestination("232.0.1.2");

// Starts the RTSP server
this.startService(new Intent(this,RtspServer.class));

P.S。如果在android中有其他rtsp SERVER库和多播。请建议。

1 个答案:

答案 0 :(得分:0)

也许为时已晚,但这里有信息可能有帮助

libstreaming是一个openSource库,所以如果你进一步查看一些代码,会话需要一些参数(查询),所以也许这就是你在VLC上什么都没有的原因。 尝试用“rtsp://192.168.1.115:1234?camera = back”进行测试。默认功能不接受空查询。

希望这有帮助

问候