Video Player

1. Requirements Document

Overview

A comprehensive video player supporting various formats, quality switching, and picture-in-picture mode. It wraps system-native players for optimal performance while providing a consistent Flutter UI.

User Stories

  • As a User, I want video playback to continue in a small floating window (PiP) while I browse other content.
  • As a User, I want to change quality (e.g., to 1080p) manually if my connection is good.
  • As a Developer, I want to play HLS streams easily.

Functional Requirements

  1. Controls: Play/Pause, Seek bar, Volume/Mute, Fullscreen toggle.
  2. Formats: HLS (.m3u8), MP4, DASH.
  3. Features:
    • Auto-play / Loop configuration.
    • Picture-in-Picture (PiP) support.
    • Captions / Subtitles.

2. Technical Document

Architecture

System Architecture

The Video Controller acts as the central brain, bridging the gap between the Flutter UI (Controls & Surface) and the platform's native player (ExoPlayer/AVPlayer). It handles state synchronization for features like PiP and Fullscreen.

API Design

Usage

MyVideoPlayer(
  source: MediaSource.network("https://stream.mux.com/hls.m3u8"),
  autoPlay: false,
  showControls: true,
  enablePip: true,
)