Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(cli): carry the recording frame through v2 project exports
EtienneLescotb6e2d71fc265
diff --git a/src/components/video-editor/projectPersistence.test.ts b/src/components/video-editor/projectPersistence.test.tsindex 87fb22ca0..800fe4bba 100644--- a/src/components/video-editor/projectPersistence.test.ts+++ b/src/components/video-editor/projectPersistence.test.ts@@ -1,4 +1,6 @@import { describe, expect, it } from "vitest";+import { migrateProjectDataToAxcutDocument } from "@/lib/ai-edition/document/migrate";+import { getEditorSettings } from "@/lib/ai-edition/store/editorSettings";import { DEFAULT_CURSOR_THEME_ID } from "@/lib/cursor/cursorThemes";import { DEFAULT_WALLPAPER } from "@/lib/wallpaper";import {@@ -7,6 +9,7 @@ import {hasProjectUnsavedChanges,normalizeProjectEditor,PROJECT_VERSION,+ type ProjectEditorState,resolveProjectMedia,validateProjectData,} from "./projectPersistence";@@ -108,6 +111,12 @@ describe("projectPersistence media compatibility", () => {expect("cursorClickBounce" in editor).toBe(false);});+ it("omits a frame or frame theme it does not know", () => {+ const editor = normalizeProjectEditor({ frame: "holo-visor", frameTheme: "neon" } as never);+ expect("frame" in editor).toBe(false);+ expect("frameTheme" in editor).toBe(false);+ });+it("normalizes webcam mask shape values safely", () => {expect(normalizeProjectEditor({ webcamMaskShape: "rounded" }).webcamMaskShape).toBe("rounded");expect(@@ -324,3 +333,34 @@ describe("wallpaper legacy normalization", () => {expect(normalized.wallpaper).toBe(DEFAULT_WALLPAPER);});});++// The CLI export's own path: normalize the v2 editor, migrate it into `legacyEditor`, then read+// it back the way the editor and the scene builder do. A key dropped on the way is a frame the+// project asks for and the export does not draw.+describe("recording frame through the CLI export path", () => {+ const migrate = (editor: Partial<ProjectEditorState>) =>+ migrateProjectDataToAxcutDocument({+ version: PROJECT_VERSION,+ media: { screenVideoPath: "/tmp/screen.mp4" },+ editor: normalizeProjectEditor(editor),+ });++ it("carries the frame and its theme into legacyEditor", () => {+ for (const frame of ["window", "laptop", "phone", "monitor"] as const) {+ const doc = migrate({ frame, frameTheme: "dark" });+ expect(doc.legacyEditor).toMatchObject({ frame, frameTheme: "dark" });+ expect(getEditorSettings(doc)).toMatchObject({ frame, frameTheme: "dark" });+ }+ });++ it("keeps the old window-light / window-dark for the editor to split", () => {+ const doc = migrate({ frame: "window-dark" });+ expect(doc.legacyEditor?.frame).toBe("window-dark");+ expect(getEditorSettings(doc)).toMatchObject({ frame: "window", frameTheme: "dark" });+ });++ it("exports no frame when the project names none, or one this build does not know", () => {+ expect(getEditorSettings(migrate({})).frame).toBe("none");+ expect(getEditorSettings(migrate({ frame: "holo-visor" } as never)).frame).toBe("none");+ });+});diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.tsindex 9b7e4bc0a..6d61484ee 100644--- a/src/components/video-editor/projectPersistence.ts+++ b/src/components/video-editor/projectPersistence.ts@@ -2,7 +2,13 @@ import { normalizeTextAnimation } from "@/lib/annotationTextAnimation";import { normalizeBlurColor, normalizeBlurType } from "@/lib/blurEffects";import { normalizeCursorThemeId } from "@/lib/cursor/cursorThemes";import type { ExportFormat, ExportQuality, GifFrameRate, GifSizePreset } from "@/lib/exporter";-import { DEFAULT_PROJECT_APPEARANCE } from "@/lib/projectDefaults";+import {+ DEFAULT_PROJECT_APPEARANCE,+ type FrameTheme,+ isFrameTheme,+ type RecordingFrame,+ readRecordingFrame,+} from "@/lib/projectDefaults";import type { ProjectMedia } from "@/lib/recordingSession";import { normalizeProjectMedia } from "@/lib/recordingSession";import { DEFAULT_WALLPAPER, WALLPAPER_PATHS } from "@/lib/wallpaper";@@ -109,6 +115,10 @@ export interface ProjectEditorState {cursorMotionBlur?: number;cursorClickBounce?: number;cursorAlwaysArrow?: boolean;+ // Same reason as the cursor keys above. `window-light` / `window-dark` are kept as stored:+ // `getEditorSettings` splits them into a frame and a theme (`readRecordingFrame`).+ frame?: RecordingFrame | "window-light" | "window-dark";+ frameTheme?: FrameTheme;}export interface EditorProjectData {@@ -500,6 +510,8 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro...(typeof editor.cursorAlwaysArrow === "boolean"? { cursorAlwaysArrow: editor.cursorAlwaysArrow }: {}),+ ...(readRecordingFrame(editor.frame) ? { frame: editor.frame } : {}),+ ...(isFrameTheme(editor.frameTheme) ? { frameTheme: editor.frameTheme } : {}),wallpaper:typeof editor.wallpaper === "string"? normalizeWallpaperValue(editor.wallpaper)