WebRTC VS HSL: Unravelling the Ultimate Showdown

8 min read
July 21, 2023

Streaming technologies play a vital role in enabling real-time communication, and understanding their differences is crucial. Today, there are a lot of video conferencing platforms that leverage different streaming media delivery protocols to enable real-time communication and high-quality video streaming and choosing the best one can be challenging.

In this article, we will compare two popular streaming technologies: HLS and WebRTC. We will delve into various aspects such as latency, delivery method, flexibility, video quality, security, scalability, and cost. Let's dive into the world of HLS and WebRTC to make an informed decision.

Table of Contents 

  1. What is HLS?
  2. HLS VS low-latency HLS
  3. What is WebRTC?
  4. HLS VS WebRTC: A comprehensive comparison
  5. WebRTC VS HLS: Which is better
  6. Redefine live streaming and video - quality with Digital Samba

What is HLS?

HLS, or HTTP Live Streaming, is a widely adopted streaming protocol designed to deliver media content over the internet. Introduced by Apple in 2009, HLS revolutionised the streaming landscape by enabling adaptive streaming and broad device compatibility.

In the HLS workflow, media content is encoded into multiple quality variants, creating several variants with different bitrates and resolutions. Each variant is divided into small segments, typically 2-10 seconds in duration, and hosted on a Content Delivery Network (CDN). The segments are then delivered to client devices via HTTP.

One of the key advantages of HLS is adaptive streaming, also known as ABR (Adaptive Bitrate Streaming). This allows the client device to dynamically adjust the quality of the stream based on network conditions and available bandwidth, ensuring smooth playback even in the face of fluctuating network conditions.

Thanks to its compatibility with a wide range of devices and browsers, HSL has gained popularity over the last decade. Today, HLS is widely implemented in applications such as live-streaming, video-on-demand and online events, to mention a few.

HLS vs. low-latency HLS

HLS was originally designed to favour reliability over speed, so at a latency of 6 - 30 seconds, it might not be the fastest protocol. This design flow raised the issue of latency streaming and the demand for low latency leading to the development of protocols such as WebRTC and Common Media Application Format. 

To resolve this flaw Apple introduced Low-Latency HLS (LL-HLS). LL-HLS is not a protocol by itself, but rather, an optimised variant of HSL, you can think of it as an extension of HLS. It was primarily developed to help minimise the delay between video capture and delivery (reduce latency.)  

So how does LL-HSL achieve low latency? LL-HLS achieves low latency and enables playback by employing techniques such as using smaller chunk sizes, reduced buffering and a faster encoding and decoding process.

While most organisations view HLS and LL-HLS as two solutions, it’s worth noting that the two are basically one and the same. But, most organisations still view them as different solutions to help their vendors make better decisions when choosing a protocol.

What is WebRTC?

WebRTC, short for Web Real-Time Communication, is a technology that enables real-time communication directly within web browsers without the need for third-party plugins or external. It provides a set of protocols and APIs that empower developers to incorporate live video, audio, and data-sharing capabilities into web applications.

At its core, WebRTC consists of three key components: getUserMedia, RTCPeerConnection, and RTCDataChannel. getUserMedia allows access to a user's camera and microphone, enabling live video and audio capture. RTCPeerConnection facilitates peer-to-peer communication, establishing direct connections between browsers for seamless data transfer. RTCDataChannel enables real-time, bidirectional data exchange between browsers.

WebRTC provides a native and hassle-free experience for users. Its peer-to-peer nature ensures low-latency communication and minimises server dependency. 

HLS vs. WebRTC: A comprehensive comparison

Latency

Historically, HLS had latency ranging from 10 to 30 seconds due to segmenting and buffering. However, the landscape changed with the introduction of LL-HLS during the 2019 Apple Worldwide Developer Conference (WWDC). Originally, HLS and LL-HLS were treated as separate protocols until Roger Panton unified them as two parts of the same solution. LL-HLS, now an integral feature of HLS, provides sub-3-second latency.

While sub-3 seconds is sufficient for most applications, certain scenarios require even lower latency. Interactive live streaming, such as auctions and telehealth, demand a closer-to-real-time experience. For ultra-low latency streaming, WebRTC latency takes the lead. However, it's important to consider the trade-offs that come with it.

Delivery Method

When it comes to the delivery method, HLS and WebRTC take different approaches.

For starters, HLS leverages HTTP-based delivery using the standard web protocols and the existing network infrastructure. This makes it highly compatible with a wide range of servers and CDNs providing efficient content distribution.

On the other hand, WebRTC takes a more P2P approach by establishing peer-to-peer connections between browsers leveraging real-time protocols such as the Real-Time Protocol (RTP) and Real-Time Control Protocol (RTCP). What’s more, WebRTC operates on UDP allowing it to establish connections without the need for a handshake between the client and server. This enables real-time communication between participants without the need for intermediate servers.

So which one has the upper hand? WebRTC was specifically designed for P2P bidirectional real-time communication while HLS relies on other protocols like TCP. As such, WebRTC’ inherent speed advantage gives it the upper hand when it comes to the delivery method. But it comes with a trade-off, it’s more susceptible to network fluctuations.

Flexibility and Compatibility

Practically, HSL is the most flexible and easily adaptable protocol but when we take into account its extension LL-HSL, things get a little tricky.

As the people’s choice, HSL is widely supported across many devices, browsers and platforms and it’s fully compatible with a CDN. What’s more, it seamlessly integrates with players and supports exciting features like closed captions and subtitling, metadata, data rights management, and insertions.

However, when we move to LL-HSL, it gets a bit muddy. At the moment, LL-HSL is quite there yet. There are various features that users really need which it currently does not support making mainstream adoption somewhat of a challenge. Additionally, it only supports Apple’s native player. However, owing to its support for browsers you simply cannot ignore LL-HSL.

What about WebRTC? WebRTC is compatible with most browsers, requiring no additional plugins. It can be adapted for workflows like simulcasting and scalable video coding (SVC), although implementation may require effort and technical expertise.

In terms of flexibility and compatibility, there is no clear winner. HLS offers wide compatibility, LL-HLS is evolving, and WebRTC provides native browser support. Consider latency and implementation requirements when making your decision.

Video Quality

When it comes to professional streaming and conferences, adaptive bitrate (ABR) capabilities are the best tool a protocol can have in its arsenal. It provides viewers with a best-in-class user experience and video quality independent of their devices or network condition.

With video quality, HLS (including LL-HSL) is the best protocol out there. As we mentioned above, multiple renditions of a single video allow players to provide high-quality video playback on different bandwidths by automatically adjusting the quality of the video stream.  

WebRTC, on the other hand, was primarily built for real-time latency and as such video quality is not its top priority. However, this does not mean that it doesn’t offer quality videos. Although it does not offer ABR stream, WebRTC employs simulcasting and selective video coding (SFU) to enhance video quality. Unlike you, typical simulcasting, WebRTC simulcasting uses a selective forward unit used to select the best bitrate option for each playback device.

WebRTC also engages in selective video coding (SVC), which typically means that it prepares media files in layers. In simple terms, each time the bitrate reduces, WebRTC uses SFU to peel away the layers – think of it like peeling an onion as the bitrate gets lower.

While HLS is the preferred choice for optimal video quality, WebRTC offers methods to improve quality and continues to evolve making it the better option here.

HLS vs. WebRTC A comprehensive comparison

Security

Security is paramount in streaming technologies. HLS supports content protection with encryption, authentication, and DRM compatibility. LL-HLS merges with HLS, providing similar security capabilities. 

WebRTC ensures secure communication through encryption and authentication, although it lacks DRM compatibility. TLS encryption is recommended for LL-HLS, while WebRTC utilises TLS for secure transit. 

While both HLS and WebRTC prioritise security, customisations may be required for advanced features. Overall, HLS offers comprehensive security measures, while WebRTC provides secure communication with encryption.

Scalability

When it comes to scalability both protocols have their pros and their cons.

For starters, HLS is easily scalable and the winner in this category, but with LL-HSL, as we mentioned before, things become a bit tricky. Before CDNs were integrated with HSL, LL-HSL seemed like a far-fetched idea. However, over the last decade, vendors have been working on developing the ever-evolving spec of live streaming but it wasn’t until recently they announced their support.

While the delay on LL-HSL is longer than that in WebRTC, it can support thousands of streamers in close to 3 seconds. However, development on LL-HSL is still ongoing and we should expect to see more advancement.

WebRTC is also not a walk within the park. Although it has far less latency rate, individually, WebRTC is designed to support small chat-based scenarios. However, there are a number of developers and streaming vendors who are coming in to create scalable solutions using ultra-low latency protocol.

So when it comes to scalability, we are yet to see the victor.

Cost

When it comes to cost, WebRTC might appear to be more cost-effective since it’s open source and free. But what about scaling and supporting a lot of users? As such, although it might be free but you’ll have to pay for a custom WebRTC CDN.

HLS on the other hand uses existing infrastructure such as HTTP and TCP-based technology. HLS comes with a higher latency but with LL-HLS this can be resolved. It also supports various features that most platforms take for granted.

WebRTC vs. HLS: Which is better? 

Before we make a decision, let’s recap:

HLS is well-suited for scenarios that need wider compatibility, adaptive streaming and broader device support. If you want to stream events or deliver content to a large audience, HLS is your protocol of choice.

On the flip side, WebRTC is ideal for browser-based real-time communication. So, if you want to hold video conferences, live collaborations or interactive gaming, then you can benefit from WebRTC. With its low latency, direct P2P communication and browser support WebRTC is the best choice for interactive experiences.

To make the right choice, consider the following:

  • your specific use case
  • the trade-offs involved
  • compatibility
  • video quality
  • scalability
  • security.

Redefine live streaming and video quality with Digital Samba

As we have seen, latency has been a major challenge with streaming media delivery protocols. Over the years, there have been major strides in both HLS and WebRTC strides with innovations such as LL-HLS and STUN and TURN servers on WebRTC, all aimed at reducing latency and improving video quality.

2 SDK banner image

However, for all your video conferences, live collaborations or interactive gaming applications, Digital Samba makes a choice since it integrates WebRTC. Digital Samba is an encrypted, GDPR-compliant end-to-end solution that offers real-time communication. Our WebRTC Video API is fully optimised for low latency, high scalability, and security all while saving you money with minimal effort.

Get your hands on our WebRTC Video API today, and start streaming audio or video in seconds with minimal effort.

Request a free consultation with our team
Improve your users’ experience with Digital Samba's WebRTC API-integrated video chat
Get a consultation
 

Get Email Notifications