Design Video Streaming Service
Problem Statement
Low-Level Design (LLD) of a Video Streaming Service that allows users to upload, stream, and manage videos online.
The system should manage video storage, playback, user preferences, and content recommendations, focusing primarily on object modeling, class design, and core feature logic, not on distributed systems or large-scale infrastructure (that belongs in HLD).
π― Goal
Design a system that can:
β Functional Requirements
1. User Management
2. Video Management
3. Streaming
4. Engagement
5. Search and Recommendation
6. Playback History
βοΈ Non-Functional Requirements
π§± Key Classes to Design
ClassResponsibility
User
Represents a platform user with details, subscriptions, playlists, and history.
Video
Represents a video with metadata, formats, uploader, and stats.
VideoFile
Represents different encodings of a video (360p, 720p, 1080p).
Channel
Represents a userβs content collection (like YouTube channel).
Playlist
Represents a list of user-selected videos.
Comment
Represents user comments on a video (supports threads).
VideoPlayer
Handles playback operations (play, pause, seek).
RecommendationEngine
Suggests videos based on user activity.
SearchService
Enables keyword and tag-based search.
VideoManager
Handles upload, encoding, and metadata updates.
EngagementManager
Manages likes, dislikes, and view counts.
π§© Example Class Relationships
1
2User
3 βββ id
4 βββ name
5 βββ List<Subscription>
6 βββ List<Playlist>
7 βββ List<WatchHistory>
8
9Video
10 βββ id
11 βββ title
12 βββ description
13 βββ uploader (User)
14 βββ List<VideoFile>
15 βββ stats (views, likes, comments)
16 βββ tags, category
17
18VideoFile
19 βββ resolution
20 βββ filePath
21 βββ format (mp4, webm)
22
23Playlist
24 βββ id
25 βββ name
26 βββ List<Video>
27
28Comment
29 βββ id
30 βββ text
31 βββ user
32 βββ timestamp
33 βββ replies (List<Comment>)π Example Flow
π¬ Video Upload Flow
βΆοΈ Video Playback Flow
π§ͺ Example Input / Output
Input:
1
2User: Sahil
3Action: Upload video
4File: intro_to_ds.mp4
5Tags: ["data structures", "tutorial"]
6Category: "Education"Output:
1
2Video uploaded successfully.
3Video ID: V10293
4Available formats: 360p, 720p, 1080pPlayback Example:
1
2User: Sahil
3Action: Play Video (V10293) at 720p
4Output: Streaming started...π Concurrency & Safety
π§ Possible Extensions
β Summary:
Design a Video Streaming Service (LLD) that supports:
Focus on object design, metadata management, and core streaming logic β not CDN or large-scale architecture.