Repository navigation
feat: stream desktop audio and video previews with native controls - #26120
Conversation
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]>
|
Warning Review limit reachedYou'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. View limit detailsLimit details: You’ve used all 10 included reviews currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe change adds an Priority: ➖ Normal Merge Risk: 🔵 Low · up to 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)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation 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 💡
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.
🔇 Additional comments (24)
src/main/media/video-range-response.ts (1)
73-90: Close the reader when a read returns after an abort.
abort()setsclosedand callsreader.close()while areader.read()is still pending. For a local file, that closes theFileHandleduring an in-flighthandle.read. When the read settles,if (closed) returndrops the bytes, so the stream itself behaves correctly. Theif (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 runsRegExp.exec, notchild_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
ownedand one entry togrants. 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 fromVideoViewercleanup, 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
📒 Files selected for processing (23)
src/main/ipc/filesystem/filesystem-file-content-inspection.tssrc/main/ipc/filesystem/filesystem-read-handlers.tssrc/main/media/video-preview-protocol.test.tssrc/main/media/video-preview-protocol.tssrc/main/media/video-range-response.test.tssrc/main/media/video-range-response.tssrc/main/startup/main-process-preflight.tssrc/main/startup/main-process-ready-foundation.tssrc/main/startup/main-process-ready-identity-write.test.tssrc/preload/api/filesystem-api.tssrc/renderer/src/components/editor/EditorEditFileSurface.tsxsrc/renderer/src/components/editor/VideoViewer.test.tsxsrc/renderer/src/components/editor/VideoViewer.tsxsrc/renderer/src/components/editor/editor-lazy-views.tssrc/renderer/src/components/editor/editor-panel-content-types.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/runtime/runtime-file-client-types.tssrc/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]>
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
1ad3042f-7ab3-42ce-8a0d-41fec3189844
📒 Files selected for processing (23)
src/main/ipc/filesystem/filesystem-file-content-inspection.tssrc/main/ipc/filesystem/filesystem-read-handlers.tssrc/main/media/media-preview-protocol.test.tssrc/main/media/media-preview-protocol.tssrc/main/media/media-range-response.test.tssrc/main/media/media-range-response.tssrc/main/startup/main-process-preflight.tssrc/main/startup/main-process-ready-foundation.tssrc/main/startup/main-process-ready-identity-write.test.tssrc/preload/api/filesystem-api.tssrc/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/components/editor/editor-panel-content-types.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/runtime/runtime-file-client-types.tssrc/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.
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:
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.
Unavailable media and local fallback
Music playback
Testing
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
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