Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

add: video editor use screen recorder fix code rabbits

Alan Trebugeaisfce2c0e75a9d
diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsx
index f3cce5e2..dbec5865 100644
--- a/src/components/video-editor/VideoEditor.tsx
+++ b/src/components/video-editor/VideoEditor.tsx
@@ -2505,15 +2505,18 @@ export default function VideoEditor() {
}
return window.electronAPI.onRecordingSessionChanged((session) => {
- if (!session) return;
- if (session.videoPath === videoSourcePath && session.webcamPath) {
- setWebcam((prev) => ({
- ...prev,
- enabled: true,
- sourcePath: session.webcamPath ?? null,
- timeOffsetMs: session.timeOffsetMs ?? prev.timeOffsetMs,
- }));
+ if (!session || session.videoPath !== videoSourcePath) {
+ return;
}
+
+ setWebcam((prev) => ({
+ ...prev,
+ enabled: Boolean(session.webcamPath),
+ sourcePath: session.webcamPath ?? null,
+ timeOffsetMs: session.webcamPath
+ ? (session.timeOffsetMs ?? prev.timeOffsetMs)
+ : DEFAULT_WEBCAM_TIME_OFFSET_MS,
+ }));
});
}, [videoSourcePath]);
diff --git a/src/components/video-editor/timeline/Item.tsx b/src/components/video-editor/timeline/Item.tsx
index 7931ce81..b38e42f7 100644
--- a/src/components/video-editor/timeline/Item.tsx
+++ b/src/components/video-editor/timeline/Item.tsx
@@ -104,6 +104,9 @@ export default function Item({
}}
{...listeners}
{...attributes}
+ data-timeline-item="true"
+ onMouseDownCapture={(event) => event.stopPropagation()}
+ onClickCapture={(event) => event.stopPropagation()}
>
<Skeleton
variant="clip"
diff --git a/src/hooks/useScreenRecorder.ts b/src/hooks/useScreenRecorder.ts
index b524c3bb..2fda1611 100644
--- a/src/hooks/useScreenRecorder.ts
+++ b/src/hooks/useScreenRecorder.ts
@@ -1067,44 +1067,42 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
// We pass null for webcamPath initially to avoid blocking on webcam disk writes/muxing.
await finalizeRecordingSession(finalPath, null);
- // 2. Perform background finalization (webcam, muxing, sidecars)
- // We don't await this to keep the UI responsive
- void (async () => {
- try {
- // Await the webcam path in the background
- const webcamPath = await webcamPathPromise;
-
- // If we have a webcam path, update the session.
- // This will broadcast a 'recording-session-changed' event that the open editor listens to.
- if (webcamPath) {
- await window.electronAPI.setCurrentRecordingSession({
- videoPath: finalPath,
- webcamPath,
- timeOffsetMs: webcamTimeOffsetMs.current,
- hideOverlayCursorByDefault: hideEditorOverlayCursorByDefault.current,
- });
- }
-
- // Store sidecars
- await storeMicrophoneSidecar(
- micFallbackBlobPromise,
- finalPath,
- fallbackStartDelayMs,
- fallbackTrackSettings,
- );
-
- // Perform muxing/renaming if on Windows
- if (isNativeWindows) {
- await window.electronAPI.muxNativeWindowsRecording(expectedDurationMs);
- }
+ // 2. Perform background finalization (webcam, muxing, sidecars)
+ // We don't await this to keep the UI responsive
+ void (async () => {
+ try {
+ // Await the webcam path in the background
+ const webcamPath = await webcamPathPromise;
+
+ // Store sidecars
+ await storeMicrophoneSidecar(
+ micFallbackBlobPromise,
+ finalPath,
+ fallbackStartDelayMs,
+ fallbackTrackSettings,
+ );
+
+ // Perform muxing/renaming if on Windows
+ if (isNativeWindows) {
+ await window.electronAPI.muxNativeWindowsRecording(expectedDurationMs);
+ }
+
+ // Update the session state to notify the editor that all background assets (webcam, mic, etc.) are now ready.
+ // This broadcasts a 'recording-session-changed' event that the open editor listens to for re-scanning assets.
+ await window.electronAPI.setCurrentRecordingSession({
+ videoPath: finalPath,
+ webcamPath,
+ timeOffsetMs: webcamTimeOffsetMs.current,
+ hideOverlayCursorByDefault: hideEditorOverlayCursorByDefault.current,
+ });
- console.log(
- `[PERF:RENDERER] Background Stop Sequence: COMPLETED in ${(performance.now() - stopStart).toFixed(2)}ms`,
- );
- } catch (bgError) {
- console.error("Error in background finalization:", bgError);
- }
- })();
+ console.log(
+ `[PERF:RENDERER] Background Stop Sequence: COMPLETED in ${(performance.now() - stopStart).toFixed(2)}ms`,
+ );
+ } catch (bgError) {
+ console.error("Error in background finalization:", bgError);
+ }
+ })();
})();
return;
}