Skip to content

Add inline video preview to the file panel - #655

Open
luckrnx09 wants to merge 1 commit into
agegr:mainfrom
luckrnx09:video-file-preview
Open

Add inline video preview to the file panel#655
luckrnx09 wants to merge 1 commit into
agegr:mainfrom
luckrnx09:video-file-preview

Conversation

@luckrnx09

Copy link
Copy Markdown

Closes #654.

Summary

Video files were not previewable: they fell through to the text-preview branch and were rejected above 256KB, and .webm was misclassified as audio. This adds a video preview path end to end.

Changes

  • lib/file-types.ts: new VIDEO_EXT_TO_MIME (mp4/m4v/webm/mov/ogv) with getVideoMime() / isVideoPath(); webm moved out of AUDIO_EXT_TO_MIME (weba remains audio).
  • app/api/files/[...path]/route.ts: read, meta, and download handle video MIME types via the existing Range-capable streamFile() — streaming and seeking work, no size cap (same as audio).
  • components/FileViewer.tsx: new VideoViewer mirroring AudioViewer (live-watch badge, duration, size, download); dispatcher routes isVideoPath() to it.
  • Tests: file-types.test.mjs covers video detection and the webm reclassification; FileViewer.state.test.mjs viewer-count/watch wiring updated for the fifth viewer.

Testing

  • npm test: 846/846 pass; tsc --noEmit and eslint clean.
  • Browser-verified against a production build with generated fixtures:
    • mp4 (H.264) and webm (VP9) play inline with controls and duration.
    • Range seek verified on a 45s mp4 (jump to 30s resumes playback; server returns 206).
    • Portrait (9:16) video is clamped to the panel height instead of overflowing.

Video files previously fell through to the text preview path and were
rejected above 256KB, and .webm was misclassified as audio. Add a
VIDEO_EXT_TO_MIME table, stream videos through the existing
Range-capable file route, and render them with a VideoViewer that
mirrors the audio viewer (live watch, duration, size, download).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Video files are not previewable in the file panel (and .webm is misdetected as audio)

1 participant