In the era of YouTube when people perceive most information through video, developing digital products being without it may be considered suicide for a business idea.
We discovered a lot of ways of developing video streaming software and verified it through practice. In this blog post, we will tell you about the most popular video streaming technology - HTTP Live Streaming.
Wanna know how to realize HLS for your application and make this process faster and more cost-effective? Stay tuned!
HTTP Live Streaming (HLS) is a streaming protocol developed and released by Apple in 2009. It reduces the time needed for video downloading and enables playing video in different quality depending on the capabilities of the user’s device.
HLS became popular thanks to several features:
The primary reason for the HLS video streaming popularity is that this protocol is compatible with the different media players, web browsers, mobile devices, as well as streaming media servers.
HLS encodes the incoming videos in various levels of quality. That allows it to change depending on the Internet speed during the playback video and makes it seamless for the end-user.
From April 30, 2020 the low latency specifications have become part of the main HLS specification and vary from 15 to 20 seconds range with HLS live streaming.
The HLS extension, called Apple Low Latency HLS (ALHLS) reduces glass-to-glass delay when streaming via HLS by reducing the time needed to start live stream playbacks and maintain it during a live streaming event.
In addition to everything previously, HLS technology allows you to turn applications into the market place by inserting dynamic ads into the streaming videos.
The work of HLS streaming is best explained in the following way:
In simple words, HLS turns the videos into a bunch of segments and specifies the duration of each segment. Then during the video streaming, the browser makes HTTP requests for these segmented files.
As previously discussed the working principle of HLS, make the right time to delve deeper into the technical specifications of the HLS protocol and see it in action.
In a previous part of the article, we defined that streaming content after it has been identified by the device needs to be sent to the transcoding service. To achieve this goal, you can utilize an AWS Elastic Transcoder, the cloud media transcoding service. The transcoder converts video files into the versions compatible with iOS devices, Android devices, set-top boxes, and browser-based players.
The next step is transferring the video to the hosting platform. As a middleware that provides secure delivery of the streaming content, you can use a Cloud Delivery Network (CDN) service by AWS - CloudFront. It is most suitable for both pre-recorded videos and live videos.
Currently, when our video is delivered to the hosting platform, it needs to be transferred to the HTML5 player. For this purpose, we recommend utilizing Video.js library that supports HTML5 video and HLS.
The easiest way to get started using Video.js is to paste the following links in your page:
By using the same protocol that powers the web, HLS lets you deploy content using ordinary web servers and content delivery networks. HLS is designed for reliability and dynamically adapts to network conditions by optimizing playback for the available speed of wired and wireless connections.’ - Apple documentation
As stated the documentation implementation of HLS into your iOS Application is not a big deal. An AVPlayer has all needed setups to minimize your work. You can just initialize an AVPlayer Item for instance with a link to the playlist.
So here we have:
This is the simplest way of adding HLS to your iOS App.
Are you considering an HLS technology as a feature for your learning app? Look at our Educational Software Solutions.
To implement HLS to the Android application you can use ExoPlayer - an application media player for Android OS.
It is built on top of Android's low level media APIs, ExoPlayer offers a more powerful and more robust alternative to MediaPlayer, with additional features and customization flexibility. Unlike the MediaPlayer API, ExoPlayer is easy to customize and extend.
For simple use cases, getting started with ExoPlayer consists of implementing the following steps: