WebRTC live streaming to unlimited viewers, with sub-second latency

Kyle Boutette
9 min readintermediate
--
View Original

Overview

The article discusses Cloudflare Stream's new feature that enables live video streaming over WebRTC with sub-second latency, allowing unlimited viewers. It highlights the limitations of traditional streaming protocols and introduces WHIP and WHEP as new open standards for ingestion and egress in live video broadcasting.

What You'll Learn

1

How to implement live streaming using WebRTC in your applications

2

Why using WHIP and WHEP standards is beneficial for developers

3

How to achieve sub-second latency in live video streaming

Prerequisites & Requirements

  • Basic understanding of WebRTC and video streaming concepts
  • Familiarity with JavaScript and web development tools(optional)

Key Questions Answered

What are the limitations of traditional live streaming protocols?
Traditional live streaming protocols like HLS and DASH typically have latencies of over 10 seconds, which do not meet the real-time expectations of viewers. Even low-latency versions like LL-HLS and LL-DASH only reduce latency to about 5 seconds, which is still inadequate for interactive applications.
How does Cloudflare Stream utilize WHIP and WHEP standards?
Cloudflare Stream uses WHIP for media ingestion and WHEP for media egress, allowing developers to broadcast live video without being locked into vendor-specific SDKs. This implementation supports open standards, making it easier for developers to build and integrate live streaming into their applications.
What advantages does sub-second latency provide for live streaming?
Sub-second latency enables real-time interactivity in applications, allowing features like live sports betting, auctions, and viewer Q&A sessions. This immediacy enhances user engagement and ensures that viewers do not miss critical moments in live events.
How can developers implement live streaming from a web browser?
Developers can implement live streaming by creating a live input in the Cloudflare Stream dashboard and using a few lines of JavaScript to connect to the WHIP client. This allows users to broadcast directly from their browsers without needing complex setups or additional software.

Key Statistics & Figures

Latency
sub-second
This latency is achieved through Cloudflare's WebRTC implementation, enabling real-time streaming for unlimited viewers.
Cost of WebRTC streaming
$1 per 1000 minutes
This pricing is comparable to traditional streaming methods like HLS or DASH, making it accessible for developers.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Protocol
Webrtc
Used for real-time communication in live streaming.
Protocol
Whip
Standard for media ingestion in live video streaming.
Protocol
Whep
Standard for media egress in live video streaming.
Programming Language
Javascript
Used for implementing live streaming functionality in web applications.

Key Actionable Insights

1
Leverage Cloudflare Stream's WebRTC capabilities to enhance user engagement in your applications.
By integrating real-time streaming features, you can create interactive experiences that keep users engaged, such as live Q&A sessions or real-time sports betting.
2
Utilize WHIP and WHEP standards to avoid vendor lock-in and enhance flexibility in your streaming solutions.
These open standards allow you to switch providers or modify your implementation without extensive rewrites, saving time and resources in the long run.
3
Experiment with sub-second latency features to improve the immediacy of your live content.
This can significantly enhance the viewer experience, especially in scenarios where timing is crucial, such as live auctions or sports events.

Common Pitfalls

1
Failing to consider network conditions when implementing live streaming can lead to poor user experiences.
Network disruptions can severely impact the performance of protocols like RTMP, which are sensitive to latency and packet loss. Using WebRTC can mitigate these issues, but developers must still account for varying network conditions.

Related Concepts

Webrtc
Live Streaming Protocols
Real-time Applications
Video Streaming Standards