Video is not one big file. It is tiny chunks, a menu of qualities, and a player that picks each piece. Here is how.
Your internet slows down for a moment. A 2-hour movie keeps playing anyway. But a small PDF from the same connection fails twice.
Weird, right? Here's the reason: streaming is just downloading many small files, and picking the quality of each one as you go. Let's build it from the simplest version up.
Simplest idea: put movie.mp4 on a server and let people download it. It can play while it loads. But:
So the file has to become smaller things. How small?
The server cuts the video into short pieces called segments. In Apple's HLS format (HTTP Live Streaming), the maximum segment length comes from a "target duration", and "a typical target duration is 10 seconds" (RFC 8216, section 6.2.1).
It is like mailing a long book as ten small parcels. If one gets lost, you resend one parcel, not everything.
Why this matters: a failure now costs you a few seconds, not the whole movie. But how does your phone know which pieces exist?
It reads a small text file first. HLS calls it a playlist (people also say manifest). RFC 8216 states that a Media Playlist "contains a list of Media Segments, which, when played sequentially, will play the multimedia presentation."
The player downloads them in order and plays them. Plain, and that's the point. It's ordinary HTTP, the same thing websites use, and the RFC notes it's built to work with "large-scale HTTP caching infrastructure".
Now the clever part: what if one movie came in several sizes?
The server makes the same video in a few qualities, like 360p, 720p and 1080p. A Master Playlist "provides a set of Variant Streams, each of which describes a different version of the same content" (RFC 8216, section 2). Each version lists its bandwidth, the speed needed to play it.
Who chooses a stack? Not the server. Your phone does.
Your player. This is adaptive bitrate: it watches how fast each piece arrives. Slow? The next piece comes from a lower stack. Fast again? It climbs back up.
MDN describes the same thing: if the data rate "doesn't look like it's keeping up, we drop down to a lower bandwidth (and consequently lower quality) stream." The RFC states that clients "should switch between different Variant Streams to adapt to network conditions."
The player decides fresh for each piece. A blurry moment means the system is working, not breaking.
Still, all those pieces sit on one machine. Where?
If it's in another country, every piece travels far. A thousand viewers pressing play at once also hit that one machine together.
The fix is a CDN (content delivery network). Fastly's learning page describes it as "distributing your website's content across a global network of edge servers", so requests go to a nearby one. A nearby copy is delivered "without having to retrieve it from your origin server."
Click Next and follow what happens when you press play.
The phone requests the playlist from the nearby edge server
Notice step 6: the origin wasn't touched at all. That's the whole win.
Here's the same thing as a map:
Chunking helps here too. Each segment is a normal small file with its own URL, so caches can hand popular pieces out again and again. It is like a local shop that keeps popular items in stock, so each customer doesn't need a trip to the factory.
| Problem | Fix |
|---|---|
| One huge file freezes | Cut into small segments |
| Phone doesn't know what exists | A playlist lists them |
| Connection speed changes | Several qualities, pick each time |
| Server too far or too busy | CDN edge servers keep copies |