使用纯 Java 的 Android 直播视频
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14049338/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Live Stream video using Android with pure java
提问by appukrb
i am trying to do a live streaming app in android, my question is what is the difference between using http and rtsp is there any way to only java code to do this, i refer so many projects already done are using java with other language combination, is there any way to stream in efficient way using java only
我正在尝试在 android 中做一个实时流媒体应用程序,我的问题是使用 http 和 rtsp 之间有什么区别,有什么方法可以只用 java 代码来做到这一点,我指的是已经完成的许多项目都在使用 java 和其他语言组合, 有没有什么方法可以只使用 java 以有效的方式进行流式传输
回答by Silverstorm
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 的意思是实时流媒体协议,是一种专门为流媒体目的而设计的协议,通过 RTSP,您可以控制媒体流中的绝对定位、录制和可能的设备控制等
- 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.
- RTSP 引入了许多新方法并具有不同的协议标识符。
- 与 HTTP 的无状态特性相反,RTSP 服务器几乎在所有情况下都需要在默认情况下维护状态。
- RTSP 服务器和客户端都可以发出请求。
- 数据通过不同的协议在带外传输。
If you want to use video streaming you have to use RTSP
如果你想使用视频流,你必须使用 RTSP
See this LINKfor more details about the protocol RTSP
有关协议 RTSP 的更多详细信息,请参阅此链接
NB
NB
To show the video content in Android you can use the VideoView
要在 Android 中显示视频内容,您可以使用 VideoView
myVideoView = (VideoView) findViewById(R.id.myview);
myVideoView.setVideoPath("rtsp://SERVER_IP_ADDR:5544/");
myVideoView.setMediaController(new MediaController(this));
As described HERE
如上所述HERE
回答by Kumaran
I would suggest you to go for RTMP (Real time messaging protocol) instead of RTSP, there are number of open source plugins available in the market, like the famous "flowplayer" which is capable of streaming the video as per the industrial standards using the RTMP protocol. It has rapidly developed its capability to stream videos on Apple devices with the existing Flowplayer source plugin. Hope this helps
我建议您使用 RTMP(实时消息传递协议)而不是 RTSP,市场上有许多开源插件可用,例如著名的“flowplayer”,它能够根据工业标准使用RTMP 协议。它使用现有的 Flowplayer 源插件快速开发了在 Apple 设备上流式传输视频的能力。希望这可以帮助
Flowplaye : flowplayer websiteWe are currently using the Akamai streaming capability coupled with flowplayer plugin for a flawless streaming experience.
Flowplaye:flowplayer 网站我们目前正在使用 Akamai 流媒体功能和 flowplayer 插件,以获得完美的流媒体体验。