Repository navigation
feat: in-app audio/video preview from the file explorer - #15733
ckdwns9121 wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 728cf6b286b9f42abfc28e70838a30bbdda3bed4 and 3ca88ec. 📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds shared audio and video MIME mappings, separate 100 MB media preview limits, and relay classification for media streams. The editor now renders supported media through Priority: ➖ Normal Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to Supported media previews work through local and streaming remote paths, with no established current-head risk requiring changes before merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation Issue Full details: Docstring CoverageExplanation Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 17 files. (5 skipped: 5 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/ipc/filesystem.ts (1)
157-158: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy liftRaising the local media preview cap to 100 MB reuses the existing full-buffer base64 IPC transport and a synchronous renderer-side decode. Both sites amplify the same underlying design choice: neither the transport nor the decode path was adapted when the ceiling doubled from the 50 MB image cap.
src/main/ipc/filesystem.ts#L157-L158: confirm the base64 IPC message for a 100 MB file (roughly 133 MB as a string) does not cause noticeable delays or memory spikes when it crosses the IPC boundary, or consider streaming large media instead of buffering and base64-encoding the whole file.src/renderer/src/components/editor/MediaViewer.tsx#L14-L28: replace the manualatob()plus per-byteUint8Arrayloop with a native decode path, for examplefetch(\data:${mimeType};base64,${base64}`).then((response) => response.blob())`, so a 100 MB file does not block the renderer main thread during decode.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: eaacb0cb-40bd-4353-98f4-f31e508c3151
📥 Commits
Reviewing files that changed from the base of the PR and between 59892a2 and 47eac3cf0b0d7fbe776600ba674a044ecb5b8f3c.
📒 Files selected for processing (17)
src/main/ipc/filesystem.test.tssrc/main/ipc/filesystem.tssrc/relay/fs-handler-file-read-media.test.tssrc/relay/fs-handler-file-read.tssrc/relay/fs-handler-stream.test.tssrc/relay/fs-handler-utils.tssrc/renderer/src/components/editor/EditorContent.tsxsrc/renderer/src/components/editor/MediaViewer.test.tsxsrc/renderer/src/components/editor/MediaViewer.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/media-file-extensions.test.tssrc/shared/media-file-extensions.tstests/e2e/media-file-preview.spec.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
Hi @brennanb2025 — gentle ping when you have a chance! It looks like the PR Checks and PR test LoC workflows are currently waiting for maintainer approval because this is my first contribution. Would you mind approving the workflow runs and taking a look at the PR when convenient? All local checks pass, and I’m happy to address any feedback or make follow-up changes. Thanks! |
|
Any chance .ogg could be included in the format list? Ogg Vorbis/Opus is natively decodable by Electron's Chromium, so it should fit the same criterion as the current set — seemingly just one more entry in src/shared/media-file-extensions.ts (.ogg → audio/ogg). It's a common format for sound assets (e.g. game/app sound effects), so it would be great to have it covered by this PR. Happy to open a follow-up instead if you'd rather keep the scope as is. |
|
Thanks for the suggestion, @kgbvsfbi — this fits the PR's existing native-decoding criterion, so I included it here rather than deferring it. AS-IS:
TO-BE:
Verification:
|
7a2e109 to
728cf6b
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Rebased this PR onto the latest upstream I also rewrote the Ogg follow-up commit so both PR commits are attributed to my personal Verification after the rebase:
The PR description has been updated to reference the new routing files. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f04e8d7d-1a38-4051-8e8b-da2867db4a53
📥 Commits
Reviewing files that changed from the base of the PR and between 5e900b1 and 728cf6b286b9f42abfc28e70838a30bbdda3bed4.
📒 Files selected for processing (19)
src/main/ipc/filesystem.test.tssrc/main/ipc/filesystem.tssrc/relay/fs-handler-file-read-media.test.tssrc/relay/fs-handler-file-read.tssrc/relay/fs-handler-stream.test.tssrc/relay/fs-handler-utils.tssrc/renderer/src/components/editor/EditorConflictReviewSurface.tsxsrc/renderer/src/components/editor/EditorEditFileSurface.tsxsrc/renderer/src/components/editor/MediaViewer.test.tsxsrc/renderer/src/components/editor/MediaViewer.tsxsrc/renderer/src/components/editor/editor-lazy-views.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/media-file-extensions.test.tssrc/shared/media-file-extensions.tstests/e2e/media-file-preview.spec.ts
🚧 Files skipped from review as they are similar to previous changes (14)
- src/relay/fs-handler-file-read.ts
- src/renderer/src/i18n/locales/zh.json
- src/relay/fs-handler-utils.ts
- src/main/ipc/filesystem.test.ts
- src/shared/media-file-extensions.ts
- src/renderer/src/i18n/locales/ja.json
- src/relay/fs-handler-stream.test.ts
- tests/e2e/media-file-preview.spec.ts
- src/main/ipc/filesystem.ts
- src/renderer/src/i18n/locales/es.json
- src/shared/media-file-extensions.test.ts
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/i18n/locales/en.json
- src/relay/fs-handler-file-read-media.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Media files (.mp3/.wav/.m4a/.mp4/.mov/.webm) opened from the file explorer now render a native in-app player instead of 'Binary file — cannot display', reusing the existing previewable-binary pipeline images and PDFs already use. - local IPC advertises media mime types with a dedicated 100MB cap - SSH relay advertises media only on the chunked stream path so legacy single-frame clients keep their small binary markers - new lazy MediaViewer component with object-URL lifecycle management Fixes #8344 Co-Authored-By: Claude Fable 5 <[email protected]>
728cf6b to
3ca88ec
Compare
|
Closing as superseded by merged desktop playback #26120 and mobile playback #26148. The desktop implementation uses bounded range streaming rather than transferring the whole file through base64. ChangJun Park, Lirone Levy, dupi, and John Cusack are credited with Co-authored-by trailers in both merge commits. |
ELI5
Clicking an audio or video file (mp3, wav, m4a, mp4, mov, webm) in the file explorer used to show "Binary file — cannot display". Now it opens a real in-app player — the same native controls you get in a browser — so you can watch a screen recording or listen to a clip without leaving Orca.
What Changed
MediaViewereditor component (src/renderer/src/components/editor/MediaViewer.tsx): renders a native<video controls>/<audio controls>element from the file's base64 payload viaBlob+URL.createObjectURL(object URLs support seeking and avoid holding a second string copy of the file). The object URL is revoked on unmount/tab close, which also unloads playback. Failure to decode shows the same error UX asImageViewer.src/shared/media-file-extensions.ts):.mp3,.wav,.m4a,.ogg,.mp4,.mov,.webm— all natively decodable by Electron's Chromium.src/main/ipc/filesystem.ts): media extensions joinPREVIEWABLE_BINARY_MIME_TYPES. Media gets its own 100MB cap (MAX_PREVIEWABLE_MEDIA_SIZE) since recordings routinely exceed the 50MB image cap; images/PDFs keep 50MB, text keeps its existing limit.src/relay/fs-handler-utils.ts,fs-handler-file-read.ts): media types are advertised only on the chunkedfs.readFileStreampath (newSTREAM_PREVIEWABLE_MIME_TYPES). The legacy single-framefs.readFileintentionally keeps media as plain binary markers — old clients read over that path in one JSON frame, and multi-MB base64 media could blow their frame budget. Relay media keeps the existing 50MB relay cap.EditorEditFileSurface.tsx,EditorConflictReviewSurface.tsx,editor-lazy-views.ts): binary previews with anaudio/*/video/*mime route to the lazy-loadedMediaViewer; everything else keeps going toImageViewer.MediaViewerstrings are in all five locale catalogs.Explicitly not in scope (matching the issue): diff-mode media preview (git diff allowlist untouched, so a changed
.mp4still shows "Binary file changed"), waveforms/thumbnails, custom transport controls, and the mobile/OMP runtime read path (orca-runtime-files.ts) — happy to follow up on that one.Why
Fixes the gap described in #8344: images and PDFs already preview in-app via the binary-preview pipeline, but audio/video fell through to "Binary file — cannot display", forcing a context switch to an external app. This reuses the exact same pipeline (
isImage+mimeTypecontract) end to end, so the change is additive and small.Linked Issue
Fixes #6751
Supersedes duplicate #8344
Visual Proof
Both captured from the E2E harness (headless Electron, seeded repo) opening the same
media-preview-clip.webmfrom the file explorer — before onmain, after on this branch. The UI language is Korean in the screenshots; the before-state text is the localized "Binary file — cannot display".Related: #12570 adds video preview to the mobile file viewer; this PR covers the desktop editor surface. The mobile/OMP runtime read path is untouched here.
Testing
pnpm lint✅ (includes localization catalog/extraction/coverage checks)pnpm typecheck✅Unit tests ✅ — new/updated suites:
src/shared/media-file-extensions.test.ts(mime map, webm/ogg coverage, non-media rejection)src/renderer/src/components/editor/MediaViewer.test.tsx(video vs audio routing, decode-failure error state, object-URL revocation on cleanup)src/main/ipc/filesystem.test.ts(webm/mp4/mp3 base64 previews; 100MB media cap allows 80MB media, rejects 101MB; images still capped at 50MB)src/relay/fs-handler-stream.test.ts(stream path advertisesvideo/webmmetadata and streams chunks intact)src/relay/fs-handler-file-read-media.test.ts(legacy single-frame path keeps media as plain binary markers; images unchanged)E2E ✅ — new
tests/e2e/media-file-preview.spec.ts: writes a real 1s VP8+Opus webm into the seeded repo, opens it from the explorer, asserts the player mounts and Chromium reachesreadyState >= HAVE_METADATA(proves the base64 → Blob → objectURL chain decodes end to end).Manually tested on macOS (headless Electron E2E run). Windows/Linux not manually tested — the change has no platform-specific code paths (mime lookup + DOM media elements).
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Implemented with Claude (Fable 5) via Claude Code, driven and reviewed by @ckdwns9121.
Review
Self-review notes, per the contribution checklist:
extname/path.join;<video>/<audio>are Chromium-native on all three OSes..movdecodability depends on the codec inside the container — undecodable files land in the same error state as broken images.Uint8Arraydecode is one pass on open (~100–300ms for very large files) and freed on tab close viarevokeObjectURL. LazyMediaViewerchunk keeps it out of the startup bundle.Blobobject URLs into media elements (no HTML injection surface); size caps bound memory.isImage: truecontract kept for media (same as the existing PDF precedent), so no renderer/main version skew issues.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
The 100MB media cap applies locally only; the relay path keeps its existing 50MB previewable-binary cap. Files over the cap show the existing "File too large" error. Streaming/seeking beyond the cap would need a custom protocol handler, called out as a follow-up in the issue.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Contributor
X handle: @SDD125232