What Is HLS
HLS stands for HTTP Live Streaming. HLS is a adaptive streaming protocol used to deliver audio video files over the internet to user end devices. It is apple’s patent used in apple devices only like Iphone , iIOS and iPOD. But now it is widely adopted in many devices like google chrome and android smartphones etc.
Working Of HLS
As shown above in the figure we gives a media file to the encoder as input. now this encoder provides MPEG 2 Transport Stream as output. Then this TS goes into the stream segmenter. Now stream segmenter gives .m3u8 fle. In HLS system the transport stream did not goes directly to the subscriber end device via HTTP. This transport stream is broken into the small chunks. Where each chunk is 10 sec long and it is in .ts extension. This .m3u8 index file is sent to user end device via HTTP.
HLS supports Adaptive Bitrate Streaming so it provides one media in three or more different data rates. A .m3u8 manifest file is downloaded in the user end device. Which contains reference links of different bitrates (720p or 1080p etc) for a media.
Now it depends on the subscriber end device (Smartphone) that which data rate of media it wants to play according to its internet connection speed. If low bandwidth internet connection is used by smartphone then smartphone automatically switch to lower data rate file. On the other side if customer is on WiFi then it switch to different data rate file according to speed of Wi-Fi. This switching decision is taken by user end device only. Which avoid the need of streaming server in HLS. Thus only HTTP web based server is needed for HTTP Live Streaming. In HLS latency is 10 to 30 seconds.
HTTP Live Streaming supports h.264 media encoding. HLS content is played in HTML5 video players. While adobe uses RTMP protocol to play online videos. Because flash videos are supported by RTMP.
HLS is MPEG 2 part 1 based while HDS (HTTP Dynamic Streaming) is MPEG 4 part 12 and part 14 based.
.m3u8 File Index
As shown above in the figure that this .m3u8 file contains three quality of media Low , Medium and high. The user end device automatically select low index , mid index or high index file according to data connection speed. So each quality contains chunks in data mentioned as .ts extension.
Advantages Of HLS
There are mainly two major advantages of HLS. The first advantage is that smartphone select automatically data rate of playing media. While second advantage is that it is widely adopted by many subscriber end devices like android box , Microsoft Edge and iOS devices.
Conclusion
Traditionally for online video playing we were using Adobe player but now HLS have came which supports H.264 encoding for online video playing in HTML 5 player. HTTP Live Streaming is widely adopted in many devices. It provides 30 seconds of latency which playing video online. Now a days HTTP Live Streaming have became mandatory for smartphone to play online videos. HTML5 videos do not support RTMP now a days, HTTP Live Streaming is mandatory for it.