Android HLS playback via Azure media services

This blog shows you how to generate Http Live Streaming (HLS) version 3 via Azure Media Services, which is a new feature we recently added, in order to support HLS playback in a wider range of Android devices. According to Google, Android platform supports Http/Https Live streaming playback, with the following restrictions:

  • • MPEG-2 TS media files only
  • • Protocol version 4 (Android 4.4 Kitkat)
  • • Protocol version 3 (Android 4.0 and above)
  • • Protocol version 2 (Android 3.x)
  • • Not supported before Android 3.0

By using Azure media services, you could deliver HLS v3 and v4 both from our media server with the following steps. We deliver HLS v4 for over a year, and we just added HLS v3 support recently, because that’s what majority of the Android phones support now.

1. Make sure you have 1 reserved streaming unit. We support dynamic packaging a multi-bitrates Mp4/Smooth streaming into HLS version 3 and version 4, and you will need at least 1 reserved streaming unit to enable dynamic packaging, You could login to Azure portal, under your media account, select Origin tab and move the slider to 1 unit.
Streaming unit2. Upload a video and encoded into Smooth Streaming (Choosing “H264 Smooth Streaming 720P” ). You could also encode your video into multi-bitrate Mp4 (Choosing “H264 Adaptive Bitrate Mp4 set 720P” ). This will always be a valid input for dynamic packaging. However, there is currently a limitation in the portal, if you generate a Mp4, once you publish the asset, portal will give you a SAS locator, instead of an origin streaming locator (you could do that through APIs). However, if we encode the file into Smooth Streaming, by clicking on publish, we will get a origin streaming locator, and that’s what we could alter the URL upon, and obtain HLS stream on the fly.
Media Services Encoding

3. Once the encoding is done, select your smooth streaming media asset, and click on Publish button at the bottom of your portal.

Publish smooth streaming asset

4. Now, copy the public URL to a note pad, and you can alter it as the following:

For HLS v4, add the highlighted part to the end of your URL:

For HLS v3, add the highlighted part to the end of your URL:

Send the above URLs to your Android phone, if your system is 4.4, you could get HLS v4 playing, otherwise, if your phone is 4.0+, you will get HLS v3 playing.

Android HLS v3 playbackWith these simple 4 steps, now you could enjoy HLS playback on your Android phone. If you have any questions, please post on our forum. Thanks.

One Response to Android HLS playback via Azure media services

Leave a Reply

Your email address will not be published. Please enter your name, email and a comment.