FSD Frontend System Design

Part VI — The Blueprint · Lesson 11.5

HLD – Video Streaming (Netflix)

In one lineAdaptive bitrate keeps the buffer full — every other decision serves that one goal.

Where you've seen itVideo quality softening for a few seconds in a tunnel, then recovering, without ever showing a spinner.

  • Time20 min
  • DiagramABR ladder + buffer state machine
  • Chapter11 · High Level Design

Diagram

Step 1⁠–⁠2Scope and scale
In scopebrowse rows · title page · player · continue watching
Out of scoperecommendations ML · billing · downloads · profiles admin
Scale250M subscribers · 4K streams up to 25 Mbps · TV / laptop / phone · network varies mid-playback
diagram
diagram
diagram

How it works

  1. HLS or DASH manifest lists renditions and segments; the player (hls.js / Shaka via Media Source Extensions) does the switching.
  2. Start low, climb fast — time-to-first-frame beats initial sharpness.
  3. Prefer dropping quality over stalling. Rebuffering is the metric that correlates with abandonment.
  4. Preload smartly: the next episode's first segments during the end credits; hover previews at the lowest rung only.
  5. Resume position synced to the server every ~10s and on visibilitychange, so any device continues where you stopped.

Trade-offs

ChoiceCost
Short segments (2s)Faster adaptation, more requests
Long segments (10s)Fewer requests, slower reaction
Large bufferResilient, wastes data if abandoned
Start at lowest rungFast start, first seconds look soft

Cross-cutting: DRM licence acquisition before first frame, captions and audio-description tracks as accessibility requirements (8.1), and player telemetry — startup time, rebuffer ratio, average bitrate — as the core quality metrics (7.2).

Interview angle

"The video keeps stalling on mobile. What do you change?"

  • Check the buffer policy first: the player should drop a rung on a draining buffer rather than defending quality.
  • Shorten segment length so adaptation reacts faster, and cap the maximum rung on small screens where 4K is invisible anyway.
  • Verify with rebuffer ratio in telemetry, not by watching it once on a good connection.

Recap

  • Keep the buffer full; quality is the variable you trade to do it.
  • Start at the lowest rung for a sub-second first frame, then climb.
  • Rebuffer ratio, not resolution, is the metric users actually feel.