Talk to us

Blog

WebRTC vs HLS: why some camera feeds lag

Short answer: WebRTC is the technology behind video calls, built to arrive in well under a second. HLS sends video in short files of a few seconds each, so it usually runs several seconds behind, but it is very reliable and works through almost any network. A good live view uses WebRTC and falls back to HLS when WebRTC can’t connect.

Why can’t a browser just play the camera’s stream?

Cameras send video over RTSP. Browsers and most apps built on web technology can’t play RTSP directly, so something has to repackage the video into a format they can play. The two common choices are WebRTC and HLS, and the choice decides how far behind real time the picture is.

How does HLS work?

HLS (HTTP Live Streaming) cuts the video into small files, typically a few seconds each, and the player downloads them one after another like web pages. Players keep a few segments in hand so playback never stalls. That buffer is the delay: commonly several seconds, and more on default settings. Low-latency HLS shortens it, but not to real time.

What HLS is good at: it’s plain HTTPS, so it passes through firewalls and proxies, works on unreliable connections, and is easy to cache.

How does WebRTC work?

WebRTC sends video as a continuous stream of packets, built for conversations where a delay of even a second feels wrong. It adapts quality to the connection on the fly and is encrypted by design. The cost is setup: two ends have to find a path to each other, which sometimes needs a relay server on restrictive networks.

How do they compare?

WebRTC HLS
Delay behind live Usually under a second Usually several seconds
Unreliable networks Lowers quality to keep up Buffers, then catches up
Strict firewalls Sometimes needs a relay Works almost everywhere
Best for Watching live, reacting, PTZ Fallback, many viewers

Why does the delay matter for security video?

  • Reacting. Talking to someone at a gate, or calling security while something is happening.
  • Pan-tilt-zoom. Steering a camera with a several-second lag overshoots every time.
  • Comparing views. Following someone across cameras is confusing when each runs a different delay behind.
  • Alerts. A notification that arrives before the picture shows it is no use.

How Supervision streams live video

Supervision starts live video in under a second over WebRTC and falls back to HLS automatically when WebRTC can’t connect, so a camera always plays. Grids use each camera’s lighter substream.

Common questions

Why is my camera feed delayed in the browser?

Most likely it’s being delivered over HLS or another buffered format. Seconds of delay are normal for HLS; under a second needs WebRTC.

Is WebRTC secure?

WebRTC encrypts media by design; there is no unencrypted mode. The rest depends on who can reach the server, so put remote access behind a VPN or the vendor’s secure gateway.

Does WebRTC use more bandwidth than HLS?

Not inherently. Both carry the same compressed video; what changes is how it’s packaged and how far behind it plays.

Supervision is self-hosted video management software for any camera brand. If this is the kind of problem you're solving, tell us about your cameras and we'll talk it through, or email hello@bipolarfactory.com.