该代码一次仅针对一名用户进行流式传输。任何人都可以帮助我同时在多个系统中播放流(将其转换为多播或广播)。
提前致谢。
库源在这里: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));
我看了github上的代码,似乎只需要指定多播地址即可SessionBuilder
类,然后底层 RTSP 服务器和 RTP 传输应该处理所有事情(至少 RTSP 响应似乎有代码来生成正确的传输描述)。所以我想添加一个setDestination
打电话给你的SessionBuilder
配置应该没问题(将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 流应该是单个的并在所有客户端之间共享。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)