Practice Hub /
Media & FeedsHard~40 min interview roundNetflixYouTubeHotstar

Video Streaming Player & Adaptive Feed (YouTube / Netflix)

Architect an adaptive HLS/DASH web video player supporting ABR switching, buffered chunk pre-fetching, picture-in-picture, and resume timestamps.

1. Interactive System Architecture Diagram

Click any architecture component below to inspect its exact responsibilities and trace connected data flows.

Controls & Seek ABR Chunks Manifest & Sync Segment Fetch Client UI Custom Controls & PiP Player Engine MSE + ABR Controller Buffer & Watch State Ahead Buffer + Sync Manifest & Telemetry Playback API Edge Video CDN Chunk Storage
Selected ComponentClient UI — Custom Controls & PiP
  • Renders `<video>` wrapped in keyboard-accessible custom controls (`Space`, `M`, `F`, `ArrowLeft/Right`).
  • Integrates Picture-in-Picture (`video.requestPictureInPicture()`) while browsing other pages.
  • Shows live buffer progress bar separate from playhead scrubber.

2. Interactive Trade-Off Simulator

Toggle between real architectural options to compare Pros, Cons, and exactly when to pick each choice in interviews.

Streaming Delivery Format

How should large 30-minute HD videos stream cleanly over variable networks?

Pros

  • Adapts bitrate dynamically per 2–4s segment when user network drops on train/4G.
  • Starts first frame quickly (< 500ms) with a lower initial bitrate segment.

Cons & Pitfalls

  • Requires server-side transcoding pipeline into multiple bitrates.
Interview Rule of Thumb: Pick HLS/DASH + MSE ABR for any real streaming feed (YouTube, courses).
Resume Timestamp Sync

How frequently should video playback timestamp sync to the backend?

Pros

  • Minimal server QPS while preserving near-exact cross-device resume timing.
  • `navigator.sendBeacon` reliably delivers final timestamp when closing browser tab.

Cons & Pitfalls

  • Up to ~10s variance only if browser crashes abruptly without unload event.
Interview Rule of Thumb: Pick periodic heartbeats + pause/exit beacons for all media players.

3. RADIO Framework Breakdown & Interview Checklist

Review each RADIO pillar cleanly and check off sections as you master them.

0 / 5 Sections Reviewed
R

Requirements & Scope

  • Functional: Adaptive play/pause/seek, speed control (0.5x–2x), captions, PiP, resume playback.
  • Non-Functional: Startup TTFF < 800ms, minimal rebuffering, accessible keyboard controls.
A

Architecture Components

  • Media Engine (`hls.js` / DASH over MSE) isolates segment fetching from React/Angular UI.
  • Bandwidth Estimator + Buffer Controller manages chunk quality switching.
  • Hover Preview Canvas / Sprite Sheet loads lightweight scrub thumbnails on seekbar hover.
D

Client Data Model

  • `PlayerState: { playing, currentTime, bufferedEnd, quality: "auto"|"720p", playbackRate, muted }`
  • `ManifestVariant: { level, bandwidthBps, width, height, segmentTemplateUrl }`
I

Interface & API Contracts

  • `GET /api/v1/videos/:id/manifest.m3u8` -> adaptive master playlist & caption tracks.
  • `POST /api/v1/videos/:id/progress` -> `{ positionSec, completed }` every 10s or on pause/exit.
O

Performance & Optimizations

  • Fetch `.m3u8` manifest at lowest bitrate first for instant first-frame playback.
  • Purge played `SourceBuffer` segments older than 30s to keep browser tab memory flat.
  • Lazy-load player scripts only when watching page opens; use `<link rel="preconnect">` to video CDN.