Add inline recording append workflow#689
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds an "inline record and append" feature: two new IPC channels ( ChangesInline Record-and-Append
Sequence Diagram(s)sequenceDiagram
participant User
participant VideoEditor as VideoEditor (Renderer)
participant Preload as electronAPI (Preload)
participant Main as Electron Main
participant FFmpeg
User->>VideoEditor: Click "Record and append"
VideoEditor->>VideoEditor: set pendingInlineAppendRef = current videoSourcePath
VideoEditor->>Preload: openRecordingHud()
Preload->>Main: invoke("open-recording-hud")
Main->>Main: showOrCreateHudOverlayWindow()
Main-->>VideoEditor: { success: true }
Note over User,Main: User records new segment in HUD
Main-->>VideoEditor: recording-session-changed event (new videoPath)
VideoEditor->>VideoEditor: detect pending append for base path
VideoEditor->>Preload: stitchVideoSources({ basePath, appendPath })
Preload->>Main: invoke("stitch-video-sources", options)
Main->>FFmpeg: execFile ffmpeg -f concat -safe 0 -c copy
FFmpeg-->>Main: stitched output path
Main-->>VideoEditor: { success: true, path }
VideoEditor->>VideoEditor: load stitched source, reset playback
VideoEditor->>VideoEditor: extend clipRegions once duration updates
Main->>VideoEditor: send("recording-hud-closed")
VideoEditor->>VideoEditor: clear pendingInlineAppendRef
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@electron/ipc/register/captions.ts`:
- Around line 95-110: The stitch-video-sources handler currently accepts
arbitrary basePath and appendPath from the renderer without validating that they
are within safe directories, which could allow a compromised renderer to access
arbitrary files. After resolving basePath and appendPath and before calling
getConcatListLine(), validate that both paths are within the approved recordings
directory returned by getRecordingsDir(). You should check that the resolved
basePath and appendPath are children of the recordingsDir to ensure they only
access approved recordings. Add this validation check before the
getConcatListLine() calls that use these paths.
- Around line 108-128: The recording concatenation handler in the captions.ts
file accepts arbitrary recording paths and always outputs to `.mp4` with FFmpeg
stream copy without validating format compatibility between basePath and
appendPath. Since the application produces both `.webm` and `.mp4` recordings,
incompatible format pairs will fail silently with unclear errors. Before the
execFileAsync call with getFfmpegBinaryPath(), add format validation by
detecting the file extensions of basePath and appendPath. Either reject mixed
formats and throw a user-friendly error, or detect the input formats and adjust
the output container (the hardcoded `.mp4` in outputPath) and FFmpeg arguments
accordingly to handle transcoding if needed. Additionally, enhance the error
message in the catch block to provide specific details about format
compatibility issues rather than the generic message.
In `@src/components/video-editor/VideoEditor.tsx`:
- Around line 3325-3340: The handleRecordInlineAppend function can be initiated
during an active export operation, which can cause state inconsistencies because
the export is reading the current source while the append flow modifies it. Add
an early guard check in handleRecordInlineAppend to return early if isExporting
is true (with an appropriate error toast message), similar to the existing
videoSourcePath check. Additionally, disable the button that triggers
handleRecordInlineAppend by checking the isExporting condition in its disabled
prop to prevent the user from initiating the append flow while an export is in
progress.
- Around line 2574-2584: The pendingInlineAppendRef is not properly scoped and
cleared, allowing unrelated recording sessions to be appended unexpectedly.
Instead of using a simple boolean flag, store the original source path or a
request token with the pending append request. Clear the pending state when the
recording HUD is closed or canceled, when the source changes, and when IPC
operations fail. Ensure the append only proceeds when the stored source matches
the current session source, preventing stale pending requests from executing
after the user cancels the HUD operation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 105ca25a-bbe0-4f4d-ab0e-54a1d68c7c70
📒 Files selected for processing (5)
electron/electron-env.d.tselectron/ipc/register/captions.tselectron/main.tselectron/preload.tssrc/components/video-editor/VideoEditor.tsx
Description
Adds an editor action to record another segment inline and append it to the current recording source without leaving the editor/project.
Motivation
Today, adding another screen recording to an existing edit requires leaving the current workflow and manually managing separate recordings. This lets users stay in the editor, open the recording HUD, capture another segment, and have it stitched onto the current source automatically.
Type of Change
Related Issue(s)
N/A
Screenshots / Video
RecordlyNewFeature-compressed.mp4
Testing Guide
+action in the editor header.Commands run: