Design Video Streaming
Design a video streaming platform like YouTube or Netflix: CDN, encoding, and adaptive streaming.
What is a video streaming system?
A video streaming system turns uploaded or live media into short, immutable segments and delivers those segments from edge caches to a player. The control plane decides what a viewer may watch and returns a manifest. The media data plane moves the expensive bytes through object storage, origins, and CDNs.
The central invariant is a published manifest references only complete, authorized, immutable media segments. A fast player cannot repair a manifest that points at missing bytes, mixed versions, or content the viewer is not allowed to receive.
This walkthrough designs global video-on-demand first. Live ingest, recommendations, comments, and creator monetization are extensions, not hidden requirements on the playback path.
Small decisions
Control plane
Owns catalog metadata, authorization, playback sessions, manifest selection, and regional policy.
Large byte flow
Media plane
Moves uploads and immutable segments through durable storage, origins, and edge caches.
Experience
Player loop
Measures throughput and buffer health, then switches among compatible renditions without interrupting playback.
Clarify the product before drawing the CDN
Start with one concrete contract: global video-on-demand for user uploads, with adaptive playback on web, mobile, and television clients.
Functional requirements
- Creators upload large files with pause, resume, integrity checks, and visible processing state.
- The platform transcodes accepted uploads into several compatible renditions and packages short HLS or DASH segments.
- Authorized viewers start playback, seek, and change quality automatically as network conditions change.
- Creators can replace metadata or remove a video without mutating already published segment objects.
- The player emits bounded quality-of-experience events such as startup time, rebuffering, selected rendition, and terminal errors.
Non-functional goals
- P95 time to first frame below 2 seconds for warm popular content.
- Rebuffering below 0.5% of watched time at the regional and device-slice level.
- Playback availability of 99.95%, with a lower rendition preferred to a stalled high-resolution stream.
- Newly uploaded standard-definition content ready within 15 minutes at the target load.
- Normal segment delivery bypasses application servers and protects origins from viral fanout.
State the exclusions
- Live streaming needs a separate low-latency ingest and packaging path.
- Recommendations and search may choose a video, but they are not dependencies of an active playback session.
- Comments, likes, billing, and creator payouts do not belong on the media request path.
- Digital-rights management can be added through license services and encrypted renditions after the base flow is sound.
Ask whether the interview prioritizes upload processing, playback delivery, or live events. Trying to deep-dive all three usually produces a wide but indefensible design.