Skip to content

krishna-kudari/ott-platform-player

Repository files navigation

Adaptive OTT Video Player Platform

Production-grade video playback system demonstrating playback performance, ABR intelligence, DRM readiness, QoE analytics, and cross-device reliability.

🎯 Problem Statement

Building a scalable video playback system that solves real-world challenges:

  • Startup Latency: Minimizing time-to-first-frame for live sports and VOD
  • ABR Intelligence: Smart bitrate adaptation based on network conditions
  • DRM Handling: Secure content delivery with Widevine L3
  • QoE Analytics: Comprehensive metrics for playback quality
  • Cross-Device Reliability: Consistent experience across Android, Web, and Smart TVs

🧠 Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   React Web   │───▢ HTML5 + MSE + EME
β”‚ Player UI     β”‚        (HLS/DASH)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β”‚ QoE Events
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Analytics Collector    β”‚
β”‚  (Node.js)              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β–²
         β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Android App   │───▢ ExoPlayer / Media3
β”‚ Player        β”‚        (MediaCodec)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“± Android Player

Core Features

  • Media3-based player abstraction supporting HLS, DASH, and LL-HLS
  • Startup latency optimization with configurable buffer controls
  • ABR intelligence with conservative/aggressive strategies
  • DRM support (Widevine L3) with fallback handling
  • Rendering decisions (SurfaceView vs TextureView) with performance metrics
  • Device-specific debugging for Samsung, Pixel, OnePlus

Key Metrics Tracked

  • Startup time (app launch β†’ first frame)
  • Manifest load time
  • Rebuffer count and duration
  • Bitrate switches
  • Dropped frames
  • Memory usage

🌐 Web Player

Core Features

  • React + TypeScript player UI
  • Shaka Player for DASH + DRM
  • HLS.js for HLS playback
  • Performance engineering with lazy rendering and worker-based parsing
  • Cross-platform mode (Desktop, Mobile, Smart TV)

Key Metrics Tracked

  • Time to first frame
  • Buffering ratio
  • Playback errors
  • Bitrate switches
  • Memory usage

πŸ“Š QoE Analytics

Metrics Collected

  • Startup Time
  • Rebuffer Ratio
  • Playback Failure Rate
  • Average Bitrate
  • Bitrate Drops
  • CMCD-style query params support

πŸš€ Getting Started

Prerequisites

  • Android Studio (for Android player)
  • Node.js 18+ (for Web player and analytics)
  • Test video URLs (HLS/DASH)

Android Player Setup

cd android-player
./gradlew build

Web Player Setup

cd web-player
npm install
npm start

Analytics Service Setup

cd analytics-service
npm install
npm start

πŸ“Š Performance Improvements

Startup Latency (Android)

  • Before: ~2.5s average
  • After: ~1.2s average (52% improvement)
  • Optimizations:
    • Reduced bufferForPlaybackMs from 2500ms to 1000ms
    • Preloading manifests
    • Adaptive LoadControl based on network type

ABR Behavior

  • Conservative strategy for cellular networks (minimize rebuffers)
  • Aggressive strategy for Wi-Fi (maximize quality)
  • Average bitrate switches: < 3 per session

πŸ” DRM Flow

  1. License Request: Player requests license from Widevine server
  2. Key Exchange: Secure key exchange via EME/CDM
  3. Content Decryption: MediaCodec decrypts content
  4. Fallback: Graceful degradation if DRM fails

🚨 Failure Handling

  • Network failures: Automatic retry with exponential backoff
  • Manifest errors: Fallback to lower quality or error state
  • DRM failures: Clear error messaging and fallback options
  • Codec failures: Hardware β†’ Software decoder fallback

πŸ§ͺ Testing

Android

  • Test on Samsung (Exynos), Pixel (Tensor), OnePlus (Snapdragon)
  • Monitor memory usage, frame drops, battery impact

Web

  • Test on Chrome Desktop, Mobile Safari, Smart TV browsers
  • Monitor startup time, buffering, memory leaks

🧠 How This Maps to JioHotstar Player Team

JD Requirement Covered by Project
ExoPlayer / Media3 βœ… Android player module
HLS / DASH / LL-HLS βœ… Multiple manifests
Widevine DRM βœ… L3 + architecture
Startup latency & buffering βœ… Instrumented & optimized
Memory / ANR prevention βœ… Profiling + reports
OEM / device quirks βœ… Device matrix testing
Web player (HTML5, MSE, EME) βœ… React + Shaka/HLS.js
QoE, CMCD, analytics βœ… Custom metrics pipeline
Smart TV readiness βœ… Web abstraction
Ownership mindset βœ… End-to-end design

πŸš€ What I'd Improve at Hotstar Scale

  1. CDN Integration: Multi-CDN failover with intelligent routing
  2. Predictive Preloading: ML-based bitrate prediction
  3. Advanced Analytics: Real-time dashboards with Grafana/Prometheus
  4. A/B Testing: Framework for player feature experimentation
  5. Edge Computing: Player logic closer to users via Cloudflare Workers
  6. Live Sports Optimization: Special handling for low-latency streams

πŸ“ Project Structure

ott-player-platform/
β”œβ”€β”€ android-player/
β”‚   β”œβ”€β”€ player-core/
β”‚   β”œβ”€β”€ metrics/
β”‚   └── debug-overlay/
β”œβ”€β”€ web-player/
β”‚   β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ metrics/
β”‚   └── tv-mode/
β”œβ”€β”€ analytics-service/
β”‚   └── collector/
└── README.md

πŸ“„ License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors