Android HLS Video

Android hls video 1
Android hls video 1 p

Problem

HTTP Live Streaming (HLS) is a method for delivering audio and video over the Internet, developed by Apple.

In contrast to earlier streaming protocols such as RTMP, HLS only requires a client device to make, and the server to handle, a series of stateless HTTP requests. Rather than maintaining a continuous open connection to the server, the client makes discrete requests for successive "chunks" of content as playback proceeds.

The protocol also allows the server to offer multiple renditions of the source media, typically ranging from low bit-rate to high. The client may thus choose to request lower- or higher-quality chunks over time, as bandwidth conditions vary.

These features make HLS particularly effective on mobile devices, and (not surprisingly, given Apple's authorship) the protocol has always been strongly supported by iOS. But it hasn't been natively supported by Android well at all, leading many app developers to turn to third-party libraries from providers like VisualOn.

Demo

Android's HLS support has lately gotten better, however, and this is demonstrated by the sample app shown here. This app is using Android's built-in MediaPlayer class to play HLS streams pretty successfully. In this demo video, the app is running on a Nexus 7 tablet loaded with Android 4.4.4.

I do still see signficant playback problems (not shown in the demo video), including a tendency to stall and not recover when connectivity is poor, and slow and unreliable seeking. So I'm not sure one could yet build a truly commercial-grade app for Android that uses HLS without relying on a third-party library. But that day might not be far off.

The Demo Video

The video being shown here is itself being streamed via HLS, if you're watching it in Safari, or in Chrome on an Android device. Otherwise, you're probably getting progressive download, possibly using Flash. The open-source Video.js player is making all those decisions automatically here, and implementing the player's controls and skin.

This is my first-ever personal experience with video production, and I know that's probably apparent 😔😃. I used Adobe Premiere Pro to edit, and Amazon Elastic Transcoder to transcode.

Source Code

Android-Test on Github.

Share
Credits