What is HLS?

HLS, or HTTP Live Streaming, is an online streaming protocol.

In layman’s terms, a streaming protocol is the way data travels from one device or system to another. These protocols are layered on top of one another to form a protocol stack. That way, protocols at each layer can focus on a specific function and cooperate with each other.

HLS is one of the top layer protocols. It’s the most popular video streaming protocol today.

What's so special about HLS?

Until recently most videos online were broadcast using Flash.

Flash worked well enough but:

❌ you had to install their extension first (remember those update Flash notifications you'd get every week?)

❌ it didn't work on Apple devices, making life difficult for Steve Jobs fanboys everywhere

❌ it was complicated and expensive to develop

❌ it used up a lot of bandwidth and RAM - so you'd get a lot of stutters and it'd slow down your device

HLS on the other hand:

✔️ works on all devices and browsers out of the box

✔️ is easy to use

✔️ is much more secure

✔️ is built to minimize bandwidth and resources

How?

HLS uses a system called Adaptive Bitrate Streaming. Here’s what that looks like. . .

HLS and Adaptive Bitrate Streaming - the science

Say you want to publish a video online.

In the old Flash days, you'd upload one video file (called the progressive video file) and that's what people watched. The trouble with that was:

  • Inconsistent quality: A 720p video would get stretched on any screen that wasn’t 720p and you’d see pixelation.
  • High buffering: The device cannot download the video stream fast enough, so the video will pause as it downloaded more data. This makes watching a video horrible for the user.

In other words, you’re not taking the viewer’s device or connection into consideration.

HLS solves both problems.

What HLS does is split your video up into 10-second segments. It then creates multiple versions of each segment in different quality levels. All of this happens behind the scenes, in real-time.

Next, it looks at your viewer's device, connection speed, and preferences.

Device: Smaller devices can make do with lower quality videos while bigger screens will need larger resolutions.

Connection: Similarly your home wifi might be able to handle 4K video lag-free, but a 4G connection would likely cap out at 1080p.

The HLS protocol determines the ideal video for the situation and sends it across.

The idea is to give a smooth viewing experience with no lags or stutters. If there's one thing we all know it's that we're all happier to watch a few minutes of lower quality video than to sit and watch a spinning icon until the stream catches up.

How HLS Streaming Works With Adaptive Bitrate Streaming

The idea is to give a smooth viewing experience with no lags or stutters. If there's one thing we all know it's that we're all happier to watch a few minutes of lower quality video than to sit  and watch a spinning icon until the stream catches up.

But there’s more.

Because the video is broken up into 10-second segments, HLS can adjust quality on the fly.

This means that as a user's internet connection changes, the HLS powered stream will switch back and forth between video qualities. . . by changing which segments of video are delivered.

How does that help in real life?

HLS in action

Imagine your viewer's on the train, going through a tunnel, idly flipping through Facebook on her phone (a 360p device) when she finds your video.

HLS realizes it's a small screen with a limited connection. . . and starts her off with a 240p video. Which is cool because you probably shot the video in 2k. If she had to watch that it'd never load. This way she gets to keep watching lag-free.

A few seconds after this her train emerges from the tunnel. Hooray, she's got 4G again.

The HLS protocol notices her signal's stronger, and figures since she's watching intently she'd probably appreciate a higher quality. So it seamlessly switches her to 360p.

No lag, no stutter, no freezes. The video just becomes clearer. Magic.

But now she's getting off the train and walking into the coffee shop. As her phone connects to the WiFi HLS notices her internet connection's stronger than ever. Let's live a little. Time for 720p.

As our viewer picks up her orders and steps back out her phone switches to 4G again. HLS says, oh well, it was good while it lasted, and switches her back to 360p.

Adaptive Bitrate Streaming In Action 

What's the catch?

There is one area in which HLS suffers - latency, but recently apple released low latency HLS which will solve that problem.

Between chopping up your video and selecting which bits to send it can take a while for the video to get started.

That means if you start live streaming at 4:00 pm your viewers won't see anything till 30 seconds later.

But you know what, in the grand scheme of things . . . 30 seconds is pretty ok. Especially considering all the benefits

Should I broadcast with HLS?

The internet by its very nature is an incredibly complex network of connections and constantly changing systems.

Right now (and for the foreseeable future, as these things go) HLS is the definitive default standard for live streaming content.

If you're NOT already broadcasting using an HLS player you're subjecting your viewers to flawed quality (i.e. quality too high or too low) and a lot more buffering than is considered polite.

Take our words on this - if you want happy and engaged viewers you want to broadcast with HLS.

. . . at least until something better comes along.

Other Protocols and The Future of Live Streaming

With the rate at which internet technology changes we wouldn’t be surprised if HLS becomes old news in a few years.

There are a few other protocols being developed right now, but the one to watch is MPEG DASH. Among other things, it’s better at handling different audio and video formats, and ad insertion.

We’ll cover MPEG DASH more in another article.

How do I use HLS?

We know we said HLS was easier to use than flash, but programming a fully functional HLS player would still take some work.

Luckily you don’t have to. Castr’s players supports HLS built in so you don’t need to worry about a thing. If you’re using Castr to broadcast anywhere on the internet you’re already delivering HLS video.

And if you’re not using Castr live streaming start streaming now using Castr.

You can do your first HLS live stream today with our live video streaming solution powered by Akamai CDN.