WebRTC vs HLS: The Delay You Get and When Each Fits
WebRTC plays a live stream about a second behind the host, and HLS plays it from several seconds to half a minute behind, because its players wait for files of the stream to be written. Choose WebRTC when viewers talk back, in a chat, a Q&A or a class, and HLS when a very large audience only watches, or needs to rewind.
This post explains where each delay comes from, with the numbers the standards give, then compares the two on cost, reach, networks and protection. It ends with how Live Stream uses both on a WordPress site: WebRTC for the live stream, HLS for its replay. For every way to stream on WordPress, start with How to live stream on a WordPress site.

WebRTC and HLS at a glance
| HLS | Low-Latency HLS | WebRTC | |
|---|---|---|---|
| Behind the host | Often 10 to 30 seconds | A few seconds | About a second |
| How video travels | Files of a few seconds each, over HTTPS | Smaller parts of those files | A stream of packets, played as they arrive |
| Who delivers it | Any CDN, which caches the files | A CDN that supports its requests | Media servers, with a connection for each viewer |
| Sizes for slow connections | The server encodes several, and the player picks one | The same | The sender sends several layers, and the server picks one for each viewer |
| Rewinding while live | Yes, as far as the playlist reaches | Yes | No, always at the live moment |
| A chat in step with the picture | No | Close | Yes |
| In the browser | Safari by itself, most others through a player script | The same, with a newer player | Built into every current browser |
| Networks | Plain HTTPS, which every network lets through | The same | UDP where it can, a relay where a network blocks it |
| Protection | HTTPS, signed links, and DRM where needed | The same | Always encrypted, no DRM |
Why HLS runs behind
HLS, HTTP Live Streaming, cuts a live stream into segments, short files of a few seconds each, and lists the newest of them in a playlist. The player reads the playlist, downloads the segments one after another, and plays them. Any web server or CDN can hand out files, which is why HLS reaches any number of viewers.
The delay is built into that design, in three parts:
- A segment is listed only once it is complete. The newest segment in the playlist already ended when it was written.
- The player starts a few segments back. The HLS standard tells a player not to choose a segment that starts less than three target durations from the end of the playlist, so that a slow download does not stop the picture.
- Segments are seconds long. The authoring specification of Apple, which made HLS, says target durations should be 6 seconds.
Put together, with 6-second segments a player starts at least 18 seconds before the end of the playlist, and the end of the playlist is already behind the camera. That is why a standard HLS stream often runs 20 seconds or more behind the host. Shorter segments bring it down: with 2-second segments, the same rule gives at least 6 seconds. They also mean more files and more requests, and less room for a download that comes late.
DASH works the same way, with segments and a manifest in place of a playlist, so it shares the delay and the strengths of HLS.
Low-Latency HLS
Low-Latency HLS splits each segment into parts and lists them as they are written, so the player does not wait for whole segments. The same specification recommends parts of one second, and says the distance a player keeps from the live end, PART-HOLD-BACK, must be at least three parts. So with the recommended parts, viewers stay at least 3 seconds behind, and usually a little more.
That is a big step from 20 seconds, and still not a conversation. It also needs a server that writes the parts and answers the requests of the player as the rules of Low-Latency HLS ask, and a CDN that passes those requests on as they expect.
Why WebRTC plays about a second behind
WebRTC is what browsers use for video calls, where a delay of seconds would make talking impossible. It sends the picture as a stream of small packets, and the player plays them as they arrive. There are no segments to finish and no files to download.
For a stream with an audience, a media server sits in the middle. The host sends one stream to it, and it passes the packets on to every viewer:
- The player holds a little. It keeps a small buffer, often under a second, to smooth out packets that arrive unevenly.
- A lost packet is asked for again. The media server keeps the last moments of the stream to send it once more.
- Layers for slow connections. The host sends the picture in several sizes at once, which the IETF calls simulcast, and the media server gives each viewer the size their screen and connection take. Nothing waits for the server to encode the stream again.
- Encrypted, always. The WebRTC security architecture requires that all media be sent over SRTP, so no stream travels in the clear.
The whole delay is the encoder, the way through the network and that small buffer, so on a smooth connection viewers see the host about a second later.
Networks and browsers
Browsers. Every current browser has WebRTC built in, on computers and phones. Safari plays HLS by itself. Elsewhere a page usually brings a player script, such as hls.js, which plays HLS through the Media Source Extensions of the browser. How to embed a live stream on your website has the code for such a player.
Networks. HLS is plain HTTPS, so it plays wherever web pages open. WebRTC sends its packets over UDP where it can. Some office, school and hotel networks let no UDP out, and then the connection goes through a relay, a TURN server, over TCP or TLS, which can add some delay. The WebRTC test of WordPlus Cloud shows whether UDP gets out of the network you are on.
Sending the stream in
WebRTC and HLS, as compared here, are about the way out, to viewers. The way in is a choice of its own. HLS services usually take the stream from an encoder over RTMP and turn it into segments. A WebRTC service can take it over WHIP, the IETF standard for sending a stream into WebRTC, which OBS has had since version 30, so the picture stays WebRTC packets from the encoder to the viewer. How to stream from OBS to WordPress over WHIP goes through the settings.
For watching, the matching standard, WHEP, is still an Internet-Draft, so each WebRTC service has its own player today.
Cost and scale
HLS is cheap to deliver to a crowd. A segment is one file, and a CDN gives the same copy to every viewer near it, so the cost follows the data delivered. That is how one stream reaches millions.
WebRTC gives every viewer a live connection to a media server, and the servers must be near the audience and large enough for it. That costs more for each viewer, which is why WebRTC streams are usually priced by the viewer and the minute. A media server that passes packets on, without encoding them again, keeps that cost down. What it takes to run those servers yourself, bandwidth included, is in Hosted or self-hosted live streaming: what each takes.
Protection
An HLS segment is a file with an address, which anyone who has it can fetch, unless the service signs its links or checks a token. HLS also works with DRM, such as FairPlay Streaming, for films and sport whose rights demand it.
A WebRTC connection is set up for one viewer, after the service decides that viewer may watch, and its media is always encrypted on the way. WebRTC has no DRM. For a members only class or a company meeting, deciding who may connect matters more than DRM, and that is where WebRTC is simple.
Which one fits
| Your stream | Fits | Why |
|---|---|---|
| A Q&A, a class, a webinar, a talk with a chat | WebRTC | Questions arrive while the host is still on the subject |
| A members only stream on your site | WebRTC | Each viewer connects after your site lets them in |
| A show a very large audience only watches | HLS | Files on a CDN cost least at that scale |
| Viewers need to rewind while it is live | HLS | A WebRTC stream is always at the live moment |
| Content whose rights demand DRM | HLS | WebRTC has none |
| The recording, after the stream ends | HLS | A replay is files anyway, and seeking in it is what HLS does well |
Some services use both at once: WebRTC for those who talk, and the same stream packaged as HLS for a large audience that only watches, with the delay of HLS for them.
How Live Stream uses both
Live Stream is a live streaming plugin for WordPress, and it plays every live stream over WebRTC, through the media servers of WordPlus Cloud:
- About a second behind. Each viewer holds about a second while the connection plays smoothly. If the picture freezes while packets are lost, the player holds two seconds, then three, and comes back down after minutes of smooth playing. The sound follows the picture.
- Layers. A host going live from the browser sends the picture in several sizes, such as 720p, 540p and 360p, and OBS sends up to three with Total Layers. Viewers on Auto get what their player and connection need (Quality).
- Who watches. Each stream is for everyone, for logged-in users or for the roles you choose, and your site decides before a viewer connects.
- What happens on the way. The Statistics of the player show the codec, the buffer, the way to the server and whether it goes through a relay.
The replay is HLS. A recorded stream is made by WordPlus Cloud while it is live, and its files go into the storage of your site, or its uploads folder. A few minutes after the stream ends, the page of the stream plays the replay to everyone who may watch the stream, through hls.js, or Safari by itself, from signed links (Recording and replays).
What it does not do: it has no HLS for the live stream itself, so viewers cannot rewind while it is live. It takes streams in over WHIP, not RTMP.
To put a stream and its chat on a page, see How to add a live stream with chat to your website. The deeper story of the delay is in Low latency live streaming: why WebRTC.
What it costs
Live Stream is free to download and streams on a WordPlus Cloud subscription. Each site streams to 50 viewers at once unmetered, however long they watch, and each viewer above that takes a credit a minute. Each WordPress site adds 5,000 credits a month to its account, and more are on the pricing page of WordPlus Cloud. Recording takes a credit a minute besides. The details are in Viewers and credits.
Frequently asked questions
Is WebRTC better than HLS?
Neither is better in general. WebRTC is better when the delay matters, because viewers talk back. HLS is better when it does not, and the audience is huge, needs to rewind, or needs DRM.
Can WebRTC stream to thousands of viewers?
Yes. Media servers pass the stream on to each viewer, and they can be chained across regions for a larger audience. It costs more per viewer than HLS. A stream in Live Stream has no limit of viewers.
Is Low-Latency HLS as fast as WebRTC?
No. With the parts its specification recommends, a player stays at least three seconds behind the live end. WebRTC plays about a second behind.
Does WebRTC work on an iPhone?
Yes. Safari on iPhone and iPad has WebRTC built in, as every current browser does.
Can a WebRTC stream be turned into HLS?
Yes. A server can package a WebRTC stream as HLS for viewers who only watch, and they then get the delay of HLS. Live Stream plays its live streams over WebRTC only, and its replays over HLS.
Is HLS the same as RTMP?
No. RTMP usually carries the stream from an encoder to a server, which then gives it to viewers as HLS. Browsers no longer play RTMP. Where RTMP still fits, and where WHIP takes its place, is in RTMP vs WebRTC.