# Frame-Accurate Video Player & Comment System: Technical Design Document This document outlines the technical design, mathematical formulas, synchronization loops, and database schemes that guarantee **100% frame-accurate playback, scrubbing, stepping, and comment navigation** in Shumai. --- ## 1. Architectural Overview Shumai's video player is a decoupled, frame-locked system that coordinates three primary components around a single state coordinator (`useFramePlayer`): ``` ┌───────────────────────────┐ │ useFramePlayer Hook │ │ (State: currentFrame) │ └──────┬─────────────▲──────┘ │ │ 1. Set currentTime │ │ 2. Sync frame index (Frame Center Nudge)│ │ (Floor-with-Epsilon) ▼ │ ┌────────────────────────────┴──┐ │ Native HTML5 Video Player │ │ (Hls.js / Native MSE) │ └───────────────────────────────┘ ▲ ▲ │ │ Stepping / │ │ Comment Selection / Scrubbing │ │ Timestamp Navigation │ │ ┌───────┴──────┐ ┌──────┴───────┐ │ Seekbar │ │ Comments │ │ (Progress) │ │ (Panel/List) │ └──────────────┘ └──────────────┘ ``` 1. **Native HTML5 Video Player (Hls.js / Native MSE):** Manages the underlying browser media stream, buffering, audio clock, and presentation. Direct `