我正在尝试在 android 中做一个实时流媒体应用程序,我的问题是使用 http 和 rtsp 有什么区别有没有办法只使用 java 代码来做到这一点,我指的是已经完成的很多项目都在使用 java 和其他语言组合,有没有什么方法可以仅使用 java 以有效的方式进行流式传输
2 回答
RTSP means Real Time Streaming Protocol, is a protocol specifically designed for streaming purpose, with RTSP you can control absolute positioning within the media stream, recording and possibly device control etc
- RTSP introduces a number of new methods and has a different
protocol identifier.
- An RTSP server needs to maintain state by default in almost all cases, as opposed to the stateless nature of HTTP.
- Both an RTSP server and client can issue requests.
- Data is carried out-of-band by a different protocol.
If you want to use video streaming you have to use RTSP
See this LINK for more details about the protocol RTSP
NB
To show the video content in Android you can use the VideoView
myVideoView = (VideoView) findViewById(R.id.myview);
myVideoView.setVideoPath("rtsp://SERVER_IP_ADDR:5544/");
myVideoView.setMediaController(new MediaController(this));
As described HERE
我建议您使用 RTMP(实时消息传递协议)而不是 RTSP,市场上有许多可用的开源插件,例如著名的“flowplayer”,它能够按照工业标准使用RTMP 协议。它使用现有的 Flowplayer 源插件迅速发展了在 Apple 设备上流式传输视频的能力。希望这可以帮助
Flowplaye:flowplayer 网站 我们目前正在使用 Akamai 流媒体功能和 flowplayer 插件,以获得完美的流媒体体验。