Skip to the page

Collaboration and heavy clients · senior

Case study: video streaming player (YouTube / Netflix / JioHotstar)

A strong video design streams adaptive HLS/DASH segments through a player library on Media Source Extensions with DRM via EME, picks bitrate from bandwidth and buffer, separates controls from the media engine, lazy-loads rows of thumbnails, saves watch progress reliably, and tracks quality-of-experience metrics.

The notes

What you must know

  • Playback stack: <video> + Media Source Extensions (MSE) fed by a library (hls.js, Shaka Player, dash.js) that downloads small segments over HTTP from a CDN; DRM through Encrypted Media Extensions (Widevine, FairPlay, PlayReady). MDN: MSE works in dedicated workers since Chrome 108; ManagedMediaSource is the variant that can evict buffered data on its own (used where memory is tight, e.g. iPhone Safari).
  • Adaptive bitrate: start low for a fast start, then choose the highest rendition below measured bandwidth × a safety factor; drop to the lowest when the buffer is almost empty; cap by player size and data-saver mode.
  • Controls layer separate from the media engine; keyboard shortcuts; captions (WebVTT) and audio tracks; picture-in-picture; fullscreen.
  • Live (cricket): live edge, low-latency HLS, a DVR window, 'Go live' button, score overlay over SSE/WS with throttled updates, approximate smoothed viewer counts, server-side ad insertion markers.
  • Home page (Netflix): rows of thumbnails lazy-loaded per row with IntersectionObserver, horizontally virtualised; hover previews start after a delay, muted, one at a time; image CDN.
  • Watch progress: save every few seconds and on visibilitychange/pagehide with sendBeacon; resume position.
  • Bundle: load player code only on the watch page or on hover-intent; preload the manifest when a user hovers a title.
  • QoE telemetry: startup time, rebuffering ratio, bitrate switches, dropped frames, playback errors by CDN/ISP.

The red pen

Common traps: mistake → fix

  • Mistake: Use one <video> per thumbnail and autoplay them all

    Fix: memory, CPU and data blow up.

  • Mistake: Serve one big MP4

    Fix: no adaptation on bad networks and slow seeking.

  • Mistake: Poll a score API every 100 ms

    Fix: millions of requests; push and throttle.

  • Mistake: Forget captions and keyboard controls

    Fix: accessibility failures.

Easy to hard

Questions interviewers ask, easy to hard

  1. Design the video player for a live cricket match with 20 million viewers.
  2. How does adaptive bitrate work? What do MSE and EME do?
  3. The network drops to 2G mid-over. What happens?
  4. Design the Netflix home page rows without loading everything.

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview