Skip to content

feat: stream desktop audio and video previews with native controls - #26120

Merged
nwparker merged 3 commits into
mainfrom
nwparker/feature-video-file-preview-watching-.mp4-.mov-fi
Oct 7, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/feature-video-file-preview-watching-.mp4-.mov-fi

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​375 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​375
Prod 20 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​389 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​383

ELI5

Click a video or music file in the desktop file explorer to play it in Orca, with native playback, seeking and volume controls. Videos also support fullscreen.

What Changed

MP4, M4V, MOV, WebM, MP3, WAV, M4A, AAC, Ogg, FLAC and Opus previously showed “Binary file — cannot display.” The existing file-read IPC now returns an opaque media URL; one lazy viewer selects Chromium’s native audio or video player from the MIME type. The Electron handler serves bounded byte ranges, rechecks local file authorization, and uses the existing SSH range reader for SSH-owned files. Media bytes never enter editor state.

Local media files also have an Open in Default App fallback. Closing or switching the viewer unloads playback; renderer teardown revokes its URLs. No dependencies or remote wire fields were added.

Why

Reviewed the contributions linked from the issue:

Contribution Assessment
#15733 — @ckdwns9121 Best submitted desktop player, with useful tests, but transfers the whole file through base64 and caps local video at 100 MB.
#12570 — @Lironeee A mobile player with a new native dependency and a 10 MB preview cap; separate from desktop opening.
#21839 — @dudupii Mobile downloads and OS share-sheet handoff; separate from desktop playback.
John Cusack’s streaming proposal Closest fit for desktop recordings: disk streaming, seeking, and a default-app fallback. No submitted PR was found.

This consolidates the native-player idea with the streaming approach and reuses Orca’s existing authorization, regular-file checks, renderer lifetime, and SSH range reads. All four contributors above have Co-authored-by trailers on the commit.

Linked Issue

Fixes #24859

Related: #6751

Visual Proof

The same WebM opened from the explorer in a hidden Electron renderer. Before was captured with the original binary read path restored; after was captured from the rebuilt final implementation.

Before After
Binary file message Video player after seeking
Unavailable media and local fallback

Media error and default app action

Music playback

Native audio player after seeking

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

Hidden Electron on macOS, driven over Playwright CDP: opened MP4, MOV and WebM through the real explorer, decoded frames, sought to nine seconds and played; opened and sought a 256 MB sparse MP4 fixture; checked a broken video’s persistent error and fallback; inspected light and dark mode. After adding audio, opened, decoded, sought and played MP3, WAV, M4A, AAC, Ogg/OGA, FLAC and Opus fixtures with sound muted. Verified switching from audio to video unloads the audio source, video seeking still works, and a broken MP3 shows the media error. Inspected audio controls in light and dark mode.

113 focused tests passed after the audio update, one existing test skipped (131 passed for the initial video change): media protocol/ranges, Strict Mode playback cleanup, filesystem IPC, local authorization and startup. Coverage includes bounded reads for a simulated 4 GB file, suffix/open-ended/invalid ranges, cancellation, renderer URL revocation, SSH ownership and disconnected SSH without a local fallback.

pnpm tc, pnpm run check:code-quality:changed, localization catalog/extraction/coverage checks, and the max-lines ratchet passed. The dev wrapper rebuilt and launched the final Electron app. Full lint, full test suite and release build are left to CI.

Review

Self-reviewed file authorization, regular-file enforcement, stream backpressure and cleanup. The new media URL is confined to the desktop IPC result; relay/runtime preview contracts retain their existing behavior.

Agent skill upstream boundary

  • Not applicable; this change copies no upstream agent skill source or resources.

Notes

Desktop playback covers local and direct SSH workspaces, including folder projects. SSH routing is covered by tests, not a live SSH playback session. Linux and Windows were not manually exercised. Mobile and paired-runtime playback remain separate work. Container support depends on the codec Chromium can decode.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Before/after screenshots attached
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path impact considered
  • Focused local checks passed; CI covers the full lint, typecheck, test and build gates

Open MP4, M4V, MOV and WebM in Chromium's native player. Serve bounded
ranges through existing local authorization and SSH reads, with a local
default-app fallback and playback cleanup.

Consolidates the video-preview approaches discussed in #24859.

Co-authored-by: ChangJun Park <[email protected]>
Co-authored-by: Lirone Levy <[email protected]>
Co-authored-by: dupi <[email protected]>
Co-authored-by: John Cusack <[email protected]>
@nwparker
nwparker requested a review from brennanb2025 as a code owner October 7, 2026 07:29
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ca8c7c78-010d-4533-9f9d-e0f5e88d2dc7
📥 Commits

Reviewing files that changed from the base of the PR and between c5cf04e and 4777827.

📒 Files selected for processing (4)
  • src/main/browser/doc-preview-protocol.test.ts
  • src/main/browser/doc-preview-protocol.ts
  • src/main/media/media-preview-protocol.ts
  • src/main/startup/main-process-preflight.ts
📝 Walkthrough

Walkthrough

The change adds an orca-media protocol for supported audio and video files. File reads can return a media URL, which the protocol serves through authorized local or SSH byte-range reads. The editor uses the URL to render audio or video controls and can offer a local default-application action when the file has no external SSH target or runtime environment. The change also adds localized playback messages and tests for range responses, protocol access, and viewer behavior.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to c5cf0

Combine the preview-scheme registrations before merging if practical. A playback or startup failure has not been established, so the remaining risk is bounded.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 24 files. (6 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #24859 requests desktop video preview with disk streaming, seeking large videos without loading the full file, and a local “Open in Default App” fallback. The PR adds a media URL and bounded byt…
Out of Scope Changes check ✅ Passed The audio formats, native audio controls, IPC support, localization, and tests extend the same desktop media-preview path as the video feature. Issue #24859 itself identifies a desktop audio/video pla…
Title check ✅ Passed The title clearly summarizes the main change: streaming desktop audio and video previews with native controls.
Description check ✅ Passed The description covers the required sections, explains the user-facing change and implementation, links the issue, provides visual proof and testing details, and addresses review notes and the checkli…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 24 files. (6 skipped: 6 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔇 Additional comments (24)
src/main/media/video-range-response.ts (1)

73-90: Close the reader when a read returns after an abort.

abort() sets closed and calls reader.close() while a reader.read() is still pending. For a local file, that closes the FileHandle during an in-flight handle.read. When the read settles, if (closed) return drops the bytes, so the stream itself behaves correctly. The if (bytes.byteLength === 0) check at Line 82 also has a problem. A zero-byte read always reports "file changed". A file that is truncated during playback is not otherwise distinguished. Both cases end safely. The OpenGrep hint on Line 27 is a false positive: that line runs RegExp.exec, not child_process.exec. No change is required.

src/shared/video-file-extensions.ts (1)

1-8: LGTM!

src/main/media/video-range-response.test.ts (1)

1-115: LGTM!

src/main/media/video-preview-protocol.ts (2)

99-109: LGTM!


52-58: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Grant map grows without bound for each renderer session.

Each distinct target adds one entry to owned and one entry to grants. These entries are removed only when the renderer is destroyed, navigates, or crashes. Closing a viewer does not revoke its grant, even though the PR description says renderer teardown revokes URLs. In a long session, each opened video adds one small entry. The memory impact is small, but grants stay valid for the whole renderer lifetime. Per-seek authorization rechecks limit the security impact. Consider an explicit revoke IPC from VideoViewer cleanup, or an LRU cap.

src/main/ipc/filesystem/filesystem-file-content-inspection.ts (1)

29-29: LGTM!

src/preload/api/filesystem-api.ts (1)

68-68: LGTM!

src/main/ipc/filesystem/filesystem-read-handlers.ts (1)

83-103: LGTM!

src/main/media/video-preview-protocol.test.ts (1)

1-126: LGTM!

src/main/startup/main-process-preflight.ts (1)

88-88: LGTM!

Also applies to: 351-351

src/main/startup/main-process-ready-foundation.ts (1)

41-41: LGTM!

Also applies to: 286-286

src/main/startup/main-process-ready-identity-write.test.ts (1)

165-165: LGTM!

src/renderer/src/components/editor/editor-panel-content-types.ts (1)

51-51: LGTM!

src/renderer/src/runtime/runtime-file-client-types.ts (1)

5-5: LGTM!

src/renderer/src/components/editor/EditorEditFileSurface.tsx (1)

2-2: LGTM!

Also applies to: 14-15, 127-140

src/renderer/src/components/editor/editor-lazy-views.ts (1)

13-13: LGTM!

src/renderer/src/components/editor/VideoViewer.tsx (1)

1-79: LGTM!

src/renderer/src/components/editor/VideoViewer.test.tsx (1)

1-55: LGTM!

src/renderer/src/i18n/locales/en.json (1)

19265-19270: LGTM!

src/renderer/src/i18n/locales/es.json (1)

19197-19201: LGTM!

src/renderer/src/i18n/locales/fr.json (1)

19197-19201: LGTM!

src/renderer/src/i18n/locales/ja.json (1)

19197-19201: LGTM!

src/renderer/src/i18n/locales/ko.json (1)

19197-19201: LGTM!

src/renderer/src/i18n/locales/zh.json (1)

19197-19201: LGTM!


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: acfa8320-1d04-4ddb-a433-af8ba633e1ce
📥 Commits

Reviewing files that changed from the base of the PR and between 4077fb4 and 28b893c.

📒 Files selected for processing (23)
  • src/main/ipc/filesystem/filesystem-file-content-inspection.ts
  • src/main/ipc/filesystem/filesystem-read-handlers.ts
  • src/main/media/video-preview-protocol.test.ts
  • src/main/media/video-preview-protocol.ts
  • src/main/media/video-range-response.test.ts
  • src/main/media/video-range-response.ts
  • src/main/startup/main-process-preflight.ts
  • src/main/startup/main-process-ready-foundation.ts
  • src/main/startup/main-process-ready-identity-write.test.ts
  • src/preload/api/filesystem-api.ts
  • src/renderer/src/components/editor/EditorEditFileSurface.tsx
  • src/renderer/src/components/editor/VideoViewer.test.tsx
  • src/renderer/src/components/editor/VideoViewer.tsx
  • src/renderer/src/components/editor/editor-lazy-views.ts
  • src/renderer/src/components/editor/editor-panel-content-types.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/runtime-file-client-types.ts
  • src/shared/video-file-extensions.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Reuse the video range protocol and lifecycle for native audio controls.
Recognize MP3, WAV, M4A, AAC, Ogg, FLAC and Opus without loading whole
files into editor state.

Co-authored-by: ChangJun Park <[email protected]>
Co-authored-by: Lirone Levy <[email protected]>
Co-authored-by: dupi <[email protected]>
Co-authored-by: John Cusack <[email protected]>
@nwparker nwparker changed the title feat: stream desktop video previews with native controls feat: stream desktop audio and video previews with native controls Oct 7, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1ad3042f-7ab3-42ce-8a0d-41fec3189844
📥 Commits

Reviewing files that changed from the base of the PR and between 28b893c and c5cf04e.

📒 Files selected for processing (23)
  • src/main/ipc/filesystem/filesystem-file-content-inspection.ts
  • src/main/ipc/filesystem/filesystem-read-handlers.ts
  • src/main/media/media-preview-protocol.test.ts
  • src/main/media/media-preview-protocol.ts
  • src/main/media/media-range-response.test.ts
  • src/main/media/media-range-response.ts
  • src/main/startup/main-process-preflight.ts
  • src/main/startup/main-process-ready-foundation.ts
  • src/main/startup/main-process-ready-identity-write.test.ts
  • src/preload/api/filesystem-api.ts
  • src/renderer/src/components/editor/EditorEditFileSurface.tsx
  • src/renderer/src/components/editor/MediaViewer.test.tsx
  • src/renderer/src/components/editor/MediaViewer.tsx
  • src/renderer/src/components/editor/editor-lazy-views.ts
  • src/renderer/src/components/editor/editor-panel-content-types.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/runtime-file-client-types.ts
  • src/shared/media-file-extensions.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@nwparker
nwparker merged commit 25e0a29 into main Oct 7, 2026
53 of 55 checks passed
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.

[Feature] video file preview (watching .mp4/.mov files inside Orca).

1 participant