Frame-accurate player for uploaded cuts with frame-pinned comments#128
What
Play uploaded cuts inside Relay with frame-level control: step one frame forward and back, jump by seconds, and see a timecode. Comments left from the player pin to the exact frame, and clicking a comment seeks to that frame — the same frame the client saw.
Today a Media Version's source is an external embed (mediaSourceValidator: YouTube, Vimeo, or a plain link). An embed gives no frame stepping and no exact frame for a comment, so this needs Relay-hosted playback, which is why it comes after approve/lock, annotations, and the board.
Notes
- This is blocked on file storage for uploaded cuts landing in Relay (
convex/r2.ts,projectFiles/projectFileVersionsproviders) and on the portal version model from the approve + lock issue. Start it once those ship. - Frame rate is not knowable from a container reliably. Read it from the file at upload and store it on the version; without a stored rate, frame stepping is a guess.
mediaVersionComments.timestampSecondsis whole seconds today. Exact frames need a frame number and/or timecode stored alongside it, so a comment survives a player that rounds differently.- Playback URLs must be signed and short-lived; a public bucket URL on a client's unreleased cut is a leak.
Acceptance criteria
- An uploaded cut plays in both the editor and the portal from Relay storage, with no external embed required.
- Player controls: play/pause, previous/next frame, previous/next second, scrub bar, volume, fullscreen.
- Keyboard: space toggles, left/right step one frame, shift + left/right step one second, and shortcuts do not fire while a comment box has focus.
- The player shows a timecode
HH:MM:SS:FFbuilt from the version's stored frame rate, and the frame counter matches the frame actually painted. - Frame stepping is monotonic and skips no frames at 23.976, 24, 25, 29.97, 30, 50, 60 fps; a conversion unit test covers each.
- A comment created from the player stores the frame number and timecode with
timestampSeconds, and seeking to a comment lands on exactly that frame in both editor and portal. - Comments in the list show a frame badge and seek on click; the player highlights the comment nearest the playhead.
- Upload stores duration and frame rate on the Media Version; versions uploaded before this ships are backfilled, and the UI degrades to second-level stepping when a rate cannot be determined.
- mp4 (H.264) and webm play; an unsupported container fails with a clear message instead of a dead player.
- Playback uses signed, expiring URLs, and an expired URL refreshes transparently rather than erroring at the client.
- Tests cover timecode conversion, frame-pinned comment round-trip, and the seek-on-comment path.
- Manual check: with a 25 fps and a 29.97 fps cut, step ten frames and confirm the same frame in the portal and the editor.
Main branch review (2026-10-19)
Reviewed 17cd594.
Status: not implemented on main. src/components/review-video-player.tsx wraps YouTube/Vimeo player APIs with getCurrentTime/seekTo in seconds. mediaSourceValidator in convex/domainValidators.ts accepts YouTube, Vimeo, or a link; the media-version schema has no stored frame rate/frame number/duration. convex/mediaVersionComments.ts accepts bounded whole-second timestamps.
Signed R2 file access already exists in convex/r2.ts, and quota enforcement in convex/projectFiles.ts; neither is a hosted frame-accurate Media Version player. Still needed: upload-to-version linkage, metadata extraction, expiring playback URLs, frame/timecode controls, exact frame-pinned comments, and tests. Approval/version history depends on #103; coordinate annotation seeking with #104. Production hosted-media readiness remains gated in docs/product/subscription-plans.md.
Mirrored issue: https://github.com/Zns-Nexus/Relay/issues/38