代码一次只为一个用户流式传输。是否有人可以帮助我同时在多个系统中播放流(将其转换为多播或广播)。提前谢谢。
库的源代码在这里:https://github.com/fyhertz/libstreaming
我当前的代码是:
mSurfaceView = (net.majorkernelpanic.streaming.gl.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(5060)); // audio port num
editor.commit();
// Configures the SessionBuilde
SessionBuilder.getInstance()
.setSurfaceView(mSurfaceView)
.setPreviewOrientation(90)
.setContext(getApplicationContext())
.setAudioEncoder(SessionBuilder.AUDIO_AAC)
.setVideoEncoder(SessionBuilder.VIDEO_NONE);
MainActivity.this.startService(new Intent(MainActivity.this,RtspServer.class));发布于 2014-10-17 00:25:06
我看了github上的代码,似乎你只需要指定SessionBuilder类的组播地址,然后底层的RTP服务器和RTP传输应该处理一切(至少RTSP响应似乎有代码来产生正确的传输描述)。所以我想在你的SessionBuilder配置中添加一个setDestination调用应该没问题(用你需要的地址替换232.0.1.2 ):
// Configures the SessionBuilde
SessionBuilder.getInstance()
.setSurfaceView(mSurfaceView)
.setPreviewOrientation(90)
.setContext(getApplicationContext())
.setAudioEncoder(SessionBuilder.AUDIO_AAC)
.setVideoEncoder(SessionBuilder.VIDEO_NONE)
.setDestination("232.0.1.2");客户端仍将通过其地址连接到RTSP服务器,但实际的RTP流应该是单一的,并在所有客户端之间共享。
https://stackoverflow.com/questions/26405539
复制相似问题