简体   繁体   English

在Android中播放.m3u8 HLS实时流

[英]Playing .m3u8 HLS live stream in Android

I am trying to achieve HLS streaming in Android. 我正在尝试在Android中实现HLS流。

I have setup the HLS streaming server (apache2) in Ubuntu desktop and able to play the stream using the VLC player on Desktop. 我已经在Ubuntu桌面上设置了HLS流服务器(apache2),并且能够在桌面上使用VLC播放器播放流。

But when i try to play the stream using VLC player in Android, I am not play the video, nor I am getting any error. 但是,当我尝试使用Android中的VLC播放器播放流时,我没有播放视频,也没有出现任何错误。

If anyone has tried similar streaming, please provide your inputs. 如果有人尝试过类似的流式传输,请提供您的输入。

Thanks 谢谢

Following some further investigation, I've found the following information that can hopefully help other people get HLS streaming on Android working. 经过进一步的调查,我发现以下信息可以帮助其他人在Android上运行HLS流。

Encoding - The video encoding, and the segmentation setup can have a large impact on the Android versions that the video supports. 编码-视频编码和分段设置可能会对视频支持的Android版本产生重大影响。 I ended up creating a video using HandBrake, with the following settings: 我最终使用以下设置使用HandBrake创建了一个视频:

MP4 File H.264; MP4文件H.264; Baseline Profile; 基准资料; Level 3 AAC Audio; 3级AAC音频; 44.1k; 44.1k; 128bit (Note: I found that JellyBean was a lot more picky about the audio than ICS/Honeycomb. Some audio bitrates would create videos that Jellybean would not play at all. In general Mono and low bitrate audio seemed to work better on Jellybean). 128bit(注意:我发现JellyBean在音频方面比ICS / Honeycomb更加挑剔。某些音频比特率会创建Jellybean根本无法播放的视频。一般而言,Mono和低比特率音频在Jellybean上似乎效果更好)。 Segmentation - Using the Apple MediaFileSegmenter, I found adding the "-no-floating-point-duration" and "-z none" flags allowed me to create a video that worked across Android 3.0->4.2 细分-使用Apple MediaFileSegmenter,我发现添加“ -no-floating-point-duration”和“ -z none”标志使我可以创建在Android 3.0-> 4.2上正常运行的视频

Gingerbread - I was unable to get Android 2.3 to work with HLS out of the box, but I did find that using the Vitamio library worked pretty well (see this question for further info) Gingerbread-我无法立即使用Android 2.3与HLS配合使用,但是我确实发现使用Vitamio库效果很好(有关更多信息,请参阅此问题

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

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