简体   繁体   English

RTSP与HLS流…可以在Android设备上流畅播放

[英]RTSP vs HLS stream … which one will play smoothly on an android device

I am working on an Android application that is aimed at Tablets only. 我正在开发仅针对平板电脑的Android应用程序。 The min required api level is 3.1. 所需的最低API级别为3.1。 The app will be streaming some live tv channels. 该应用将流式传输一些直播电视频道。

I have tested both RTSP & HLS and both run well. 我已经测试了RTSP和HLS,并且都运行良好。 However HLS does not seem to work better and VideoView 's onCompletion is called which should not be called as the stream is from live TV which is not yet completed. 但是,HLS似乎并不能更好地工作,并且应该调用VideoViewonCompletion ,因为流来自尚未完成的直播电视,因此不应调用它。

I have RTSP & HLS streams urls of each TV channel. 我有每个电视频道的RTSP和HLS流网址。 I know Android Android 3.0+ supports HLS but i can also play RTSP. 我知道Android Android 3.0+支持HLS,但我也可以播放RTSP。

Which one is better than the other and why? 哪一个比另一个更好,为什么?

RTSP is only supported over UDP. 仅通过UDP支持RTSP。 So if your clients are over the internet where there can be packet loss, it's not a good option. 因此,如果您的客户在可能会丢包的互联网上,那不是一个好选择。 But for a local network it's fine. 但是对于本地网络来说,这很好。

HLS has pretty weak support in Android, and they seem to break it in a new way with every release. HLS在Android中的支持很弱,并且每个版本似乎都以一种新的方式打破了它。 That said, it's probably what you need to use if you're wanting video over the internet. 就是说,如果您想通过互联网观看视频,可能就需要使用它。 There are some 3rd party libraries available (vitamio and nextreaming) that can allow a more consistent experience across multiple devices and Android versions. 有一些第三方库可用(vitamio和nextreaming),它们可以在多个设备和Android版本上提供更一致的体验。

I tested NexStreaming and it's pretty good. 我测试了NexStreaming,它非常好。 I would say better than Vitamio. 我会说比Vitamio好。 But it's not free. 但这不是免费的。 You can request a trial SDK via their website. 您可以通过他们的网站申请试用版SDK。 The SDK has some .jar you can access from an Android app, as well as some native (.so) libs where the decoding happens (I guess). 该SDK包含一些您可以从Android应用程序访问的.jar,以及一些进行解码的本机(.so)库(我想)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM