Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

feat(effects): pick a device frame in the Effects pane

EtienneLescot6b5dc1296f73
diff --git a/src/components/ai-edition/NewEditorShell.module.css b/src/components/ai-edition/NewEditorShell.module.css
index af43610a9..fcb85dc0f 100644
--- a/src/components/ai-edition/NewEditorShell.module.css
+++ b/src/components/ai-edition/NewEditorShell.module.css
@@ -908,8 +908,12 @@
cursor: pointer;
text-align: left;
}
-.actionMenuRow:hover { background: var(--surface-2); }
+.actionMenuRow:hover:not(:disabled) { background: var(--surface-2); }
.actionMenuRow.isActive { background: color-mix(in oklab, var(--brand), transparent 82%); }
+/* A row the project cannot take (a portrait device frame on a landscape timeline) stays in the
+ list so the option is still discoverable, but has to LOOK unavailable — and the reason rides
+ in its `actionMenuCount` slot on the right. */
+.actionMenuRow:disabled { cursor: default; opacity: 0.5; }
/* Separates the fixed presets from the shapes this timeline actually holds. */
.actionMenuGroup {
padding: 8px 8px 4px;
@@ -947,7 +951,6 @@
padding-left: 4px;
border-left: 1px solid var(--border);
}
-.presetActions .actionMenuRow:disabled { cursor: default; opacity: 0.5; }
.presetStatus {
display: flex;
align-items: center;
diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsx
index 2971fec33..398678e98 100644
--- a/src/components/ai-edition/RightPanes.tsx
+++ b/src/components/ai-edition/RightPanes.tsx
@@ -47,7 +47,10 @@ import { WALLPAPER_MOTIONS, type WallpaperMotion } from "@/components/video-edit
import { useI18n, useScopedT } from "@/contexts/I18nContext";
import { resolveCaptionLane } from "@/lib/ai-edition/captions/settings";
import { collapseTracksToPills, trackGroupId } from "@/lib/ai-edition/document/audioTracks";
-import { collectNativeFormats } from "@/lib/ai-edition/document/outputFormat";
+import {
+ collectNativeFormats,
+ resolveAspectRatioValue,
+} from "@/lib/ai-edition/document/outputFormat";
import type { InsertSide } from "@/lib/ai-edition/document/transcript";
import type {
AxcutAsset,
@@ -94,7 +97,11 @@ import {
themePickerPreviewAssets,
} from "@/lib/cursor/cursorThemes";
import { buildGradientFromEditor } from "@/lib/gradientBuilder";
-import { RECORDING_FRAMES, type RecordingFrame } from "@/lib/projectDefaults";
+import {
+ RECORDING_FRAMES,
+ type RecordingFrame,
+ recordingFrameBlockedReason,
+} from "@/lib/projectDefaults";
import {
classifyWallpaper,
resolveImageWallpaperUrl,
@@ -2380,6 +2387,10 @@ const RECORDING_FRAME_LABEL_KEYS: Record<RecordingFrame, string> = {
none: "effects.windowNone",
"window-light": "effects.windowLight",
"window-dark": "effects.windowDark",
+ browser: "effects.frameBrowser",
+ laptop: "effects.frameLaptop",
+ phone: "effects.framePhone",
+ monitor: "effects.frameMonitor",
};
/**
@@ -2404,6 +2415,12 @@ export function VideoEffectsPane() {
// can never disagree about what shape the footage is. Already sorted by clip count then by
// pixel area, so [0] is "the shape most of this timeline is in" with no heuristic of ours.
const nativeFormats = useMemo(() => (document ? collectNativeFormats(document) : []), [document]);
+ // The shape the export will actually have, `"native"` resolved — what decides whether a
+ // portrait device frame can wrap this recording at all.
+ const outputAspect = useMemo(
+ () => resolveAspectRatioValue(document, settings.aspectRatio),
+ [document, settings.aspectRatio],
+ );
const hasTiltedZoom = (document?.zoomRanges ?? []).some((z) => z.rotationPreset != null);
const [fitMenuOpen, setFitMenuOpen] = useState(false);
const [ratioMenuOpen, setRatioMenuOpen] = useState(false);
@@ -2621,24 +2638,33 @@ export function VideoEffectsPane() {
className="w-auto border-0 bg-transparent p-0 shadow-none"
>
<div className={styles.actionMenu} role="menu" aria-label={ts("effects.window")}>
- {RECORDING_FRAMES.map((frame) => (
- <button
- type="button"
- role="menuitem"
- key={frame}
- className={`${styles.actionMenuRow}${
- frame === settings.frame ? ` ${styles.isActive}` : ""
- }`}
- onClick={() => {
- setFrameMenuOpen(false);
- void set({ frame });
- }}
- >
- <span className={styles.actionMenuMain}>
- {ts(RECORDING_FRAME_LABEL_KEYS[frame])}
- </span>
- </button>
- ))}
+ {RECORDING_FRAMES.map((frame) => {
+ // A device this project's shape cannot carry STAYS in the list, greyed,
+ // with the reason on the row. A control that silently disappears leaves
+ // the user hunting for a frame that was there yesterday.
+ const blocked = recordingFrameBlockedReason(frame, outputAspect);
+ return (
+ <button
+ type="button"
+ role="menuitem"
+ key={frame}
+ disabled={blocked != null}
+ title={blocked ? ts(blocked) : undefined}
+ className={`${styles.actionMenuRow}${
+ frame === settings.frame ? ` ${styles.isActive}` : ""
+ }`}
+ onClick={() => {
+ setFrameMenuOpen(false);
+ void set({ frame });
+ }}
+ >
+ <span className={styles.actionMenuMain}>
+ {ts(RECORDING_FRAME_LABEL_KEYS[frame])}
+ </span>
+ {blocked ? <span className={styles.actionMenuCount}>{ts(blocked)}</span> : null}
+ </button>
+ );
+ })}
</div>
</PopoverContent>
</Popover>
diff --git a/src/i18n/locales/ar/settings.json b/src/i18n/locales/ar/settings.json
index 496c1693e..cbe6ec118 100644
--- a/src/i18n/locales/ar/settings.json
+++ b/src/i18n/locales/ar/settings.json
@@ -122,7 +122,12 @@
"windowNone": "بلا",
"windowLight": "فاتح",
"windowDark": "داكن",
- "windowHelp": "يرسم شريط عنوان وإطار نافذة حول التسجيل."
+ "frameBrowser": "متصفح",
+ "frameLaptop": "حاسوب محمول",
+ "framePhone": "هاتف",
+ "frameMonitor": "شاشة",
+ "frameNeedsPortrait": "المشاريع الطولية فقط",
+ "windowHelp": "يرسم إطار نافذة أو جهازًا مجسمًا ثلاثي الأبعاد حول التسجيل."
},
"stylePresets": {
"button": "الإعدادات المسبقة",
diff --git a/src/i18n/locales/cs/settings.json b/src/i18n/locales/cs/settings.json
index 6d44dee1d..592026251 100644
--- a/src/i18n/locales/cs/settings.json
+++ b/src/i18n/locales/cs/settings.json
@@ -122,7 +122,12 @@
"windowNone": "Žádné",
"windowLight": "Světlé",
"windowDark": "Tmavé",
- "windowHelp": "Kolem záznamu vykreslí záhlaví a okraj okna."
+ "frameBrowser": "Prohlížeč",
+ "frameLaptop": "Notebook",
+ "framePhone": "Telefon",
+ "frameMonitor": "Monitor",
+ "frameNeedsPortrait": "Jen projekty na výšku",
+ "windowHelp": "Nakreslí okenní rám nebo zařízení modelované ve 3D kolem nahrávky."
},
"stylePresets": {
"button": "Předvolby",
diff --git a/src/i18n/locales/de/settings.json b/src/i18n/locales/de/settings.json
index a64253686..94b63789a 100644
--- a/src/i18n/locales/de/settings.json
+++ b/src/i18n/locales/de/settings.json
@@ -122,7 +122,12 @@
"windowNone": "Keins",
"windowLight": "Hell",
"windowDark": "Dunkel",
- "windowHelp": "Zeichnet eine Fenstertitelleiste und einen Rahmen um die Aufnahme."
+ "frameBrowser": "Browser",
+ "frameLaptop": "Notebook",
+ "framePhone": "Smartphone",
+ "frameMonitor": "Monitor",
+ "frameNeedsPortrait": "Nur Hochformat-Projekte",
+ "windowHelp": "Zeichnet einen Fensterrahmen oder ein in 3D modelliertes Gerät um die Aufnahme."
},
"stylePresets": {
"button": "Vorgaben",
diff --git a/src/i18n/locales/en/settings.json b/src/i18n/locales/en/settings.json
index b5695016c..98bd7c6dc 100644
--- a/src/i18n/locales/en/settings.json
+++ b/src/i18n/locales/en/settings.json
@@ -122,7 +122,12 @@
"windowNone": "None",
"windowLight": "Light",
"windowDark": "Dark",
- "windowHelp": "Draws a window title bar and border around the recording."
+ "frameBrowser": "Browser",
+ "frameLaptop": "Laptop",
+ "framePhone": "Phone",
+ "frameMonitor": "Monitor",
+ "frameNeedsPortrait": "Portrait projects only",
+ "windowHelp": "Draws a window chrome, or a device modelled in 3D, around the recording."
},
"stylePresets": {
"button": "Presets",
diff --git a/src/i18n/locales/es/settings.json b/src/i18n/locales/es/settings.json
index 29ac8fd5f..4260e7bea 100644
--- a/src/i18n/locales/es/settings.json
+++ b/src/i18n/locales/es/settings.json
@@ -122,7 +122,12 @@
"windowNone": "Ninguna",
"windowLight": "Clara",
"windowDark": "Oscura",
- "windowHelp": "Dibuja una barra de título y un borde de ventana alrededor de la grabación."
+ "frameBrowser": "Navegador",
+ "frameLaptop": "Portátil",
+ "framePhone": "Teléfono",
+ "frameMonitor": "Monitor",
+ "frameNeedsPortrait": "Solo proyectos verticales",
+ "windowHelp": "Dibuja un marco de ventana, o un dispositivo modelado en 3D, alrededor de la grabación."
},
"stylePresets": {
"button": "Preajustes",
diff --git a/src/i18n/locales/fr/settings.json b/src/i18n/locales/fr/settings.json
index f06bf6107..b622c8f4c 100644
--- a/src/i18n/locales/fr/settings.json
+++ b/src/i18n/locales/fr/settings.json
@@ -122,7 +122,12 @@
"windowNone": "Aucune",
"windowLight": "Claire",
"windowDark": "Sombre",
- "windowHelp": "Dessine une barre de titre et une bordure de fenêtre autour de l'enregistrement."
+ "frameBrowser": "Navigateur",
+ "frameLaptop": "Portable",
+ "framePhone": "Téléphone",
+ "frameMonitor": "Moniteur",
+ "frameNeedsPortrait": "Projets en portrait uniquement",
+ "windowHelp": "Dessine un chrome de fenêtre, ou un appareil modelé en 3D, autour de l'enregistrement."
},
"stylePresets": {
"button": "Préréglages",
diff --git a/src/i18n/locales/it/settings.json b/src/i18n/locales/it/settings.json
index 4554f537c..b0e1abb38 100644
--- a/src/i18n/locales/it/settings.json
+++ b/src/i18n/locales/it/settings.json
@@ -122,7 +122,12 @@
"windowNone": "Nessuna",
"windowLight": "Chiara",
"windowDark": "Scura",
- "windowHelp": "Disegna una barra del titolo e un bordo di finestra attorno alla registrazione."
+ "frameBrowser": "Browser",
+ "frameLaptop": "Portatile",
+ "framePhone": "Telefono",
+ "frameMonitor": "Monitor",
+ "frameNeedsPortrait": "Solo progetti verticali",
+ "windowHelp": "Disegna una cornice di finestra, o un dispositivo modellato in 3D, attorno alla registrazione."
},
"stylePresets": {
"button": "Preset",
diff --git a/src/i18n/locales/ja-JP/settings.json b/src/i18n/locales/ja-JP/settings.json
index 399b34c77..8ff34d875 100644
--- a/src/i18n/locales/ja-JP/settings.json
+++ b/src/i18n/locales/ja-JP/settings.json
@@ -122,7 +122,12 @@
"windowNone": "なし",
"windowLight": "ライト",
"windowDark": "ダーク",
- "windowHelp": "録画の周りにウィンドウのタイトルバーと枠を描画します。"
+ "frameBrowser": "ブラウザー",
+ "frameLaptop": "ノートPC",
+ "framePhone": "スマートフォン",
+ "frameMonitor": "モニター",
+ "frameNeedsPortrait": "縦向きのプロジェクトのみ",
+ "windowHelp": "録画の周囲にウィンドウ枠、または 3D でモデリングされたデバイスを描画します。"
},
"stylePresets": {
"button": "プリセット",
diff --git a/src/i18n/locales/ko-KR/settings.json b/src/i18n/locales/ko-KR/settings.json
index 97a53c12c..c3249b07c 100644
--- a/src/i18n/locales/ko-KR/settings.json
+++ b/src/i18n/locales/ko-KR/settings.json
@@ -122,7 +122,12 @@
"windowNone": "없음",
"windowLight": "밝게",
"windowDark": "어둡게",
- "windowHelp": "녹화 화면 주위에 창 제목 표시줄과 테두리를 그립니다."
+ "frameBrowser": "브라우저",
+ "frameLaptop": "노트북",
+ "framePhone": "휴대폰",
+ "frameMonitor": "모니터",
+ "frameNeedsPortrait": "세로 프로젝트만 가능",
+ "windowHelp": "녹화 주위에 창 테두리 또는 3D로 모델링된 기기를 그립니다."
},
"stylePresets": {
"button": "프리셋",
diff --git a/src/i18n/locales/pt-BR/settings.json b/src/i18n/locales/pt-BR/settings.json
index 37755ccca..2dabddec8 100644
--- a/src/i18n/locales/pt-BR/settings.json
+++ b/src/i18n/locales/pt-BR/settings.json
@@ -122,7 +122,12 @@
"windowNone": "Nenhuma",
"windowLight": "Clara",
"windowDark": "Escura",
- "windowHelp": "Desenha uma barra de título e uma borda de janela ao redor da gravação."
+ "frameBrowser": "Navegador",
+ "frameLaptop": "Notebook",
+ "framePhone": "Celular",
+ "frameMonitor": "Monitor",
+ "frameNeedsPortrait": "Apenas projetos verticais",
+ "windowHelp": "Desenha uma moldura de janela, ou um dispositivo modelado em 3D, ao redor da gravação."
},
"stylePresets": {
"button": "Predefinições",
diff --git a/src/i18n/locales/ru/settings.json b/src/i18n/locales/ru/settings.json
index f02832acb..705fb20cf 100644
--- a/src/i18n/locales/ru/settings.json
+++ b/src/i18n/locales/ru/settings.json
@@ -122,7 +122,12 @@
"windowNone": "Нет",
"windowLight": "Светлое",
"windowDark": "Тёмное",
- "windowHelp": "Рисует заголовок и рамку окна вокруг записи."
+ "frameBrowser": "Браузер",
+ "frameLaptop": "Ноутбук",
+ "framePhone": "Телефон",
+ "frameMonitor": "Монитор",
+ "frameNeedsPortrait": "Только вертикальные проекты",
+ "windowHelp": "Рисует рамку окна или устройство, смоделированное в 3D, вокруг записи."
},
"stylePresets": {
"button": "Пресеты",
diff --git a/src/i18n/locales/tr/settings.json b/src/i18n/locales/tr/settings.json
index 428db34e5..76f322aba 100644
--- a/src/i18n/locales/tr/settings.json
+++ b/src/i18n/locales/tr/settings.json
@@ -122,7 +122,12 @@
"windowNone": "Yok",
"windowLight": "Açık",
"windowDark": "Koyu",
- "windowHelp": "Kaydın çevresine bir pencere başlık çubuğu ve kenarlığı çizer."
+ "frameBrowser": "Tarayıcı",
+ "frameLaptop": "Dizüstü",
+ "framePhone": "Telefon",
+ "frameMonitor": "Monitör",
+ "frameNeedsPortrait": "Yalnızca dikey projeler",
+ "windowHelp": "Kaydın çevresine bir pencere çerçevesi ya da 3B modellenmiş bir cihaz çizer."
},
"stylePresets": {
"button": "Ön ayarlar",
diff --git a/src/i18n/locales/vi/settings.json b/src/i18n/locales/vi/settings.json
index 10f951b99..72a085092 100644
--- a/src/i18n/locales/vi/settings.json
+++ b/src/i18n/locales/vi/settings.json
@@ -122,7 +122,12 @@
"windowNone": "Không",
"windowLight": "Sáng",
"windowDark": "Tối",
- "windowHelp": "Vẽ thanh tiêu đề và viền cửa sổ quanh bản ghi."
+ "frameBrowser": "Trình duyệt",
+ "frameLaptop": "Máy tính xách tay",
+ "framePhone": "Điện thoại",
+ "frameMonitor": "Màn hình",
+ "frameNeedsPortrait": "Chỉ dự án dọc",
+ "windowHelp": "Vẽ khung cửa sổ, hoặc một thiết bị dựng 3D, quanh bản ghi."
},
"stylePresets": {
"button": "Cài đặt sẵn",
diff --git a/src/i18n/locales/zh-CN/settings.json b/src/i18n/locales/zh-CN/settings.json
index dd66cbe08..79e77fc98 100644
--- a/src/i18n/locales/zh-CN/settings.json
+++ b/src/i18n/locales/zh-CN/settings.json
@@ -122,7 +122,12 @@
"windowNone": "无",
"windowLight": "浅色",
"windowDark": "深色",
- "windowHelp": "在录制内容周围绘制窗口标题栏和边框。"
+ "frameBrowser": "浏览器",
+ "frameLaptop": "笔记本电脑",
+ "framePhone": "手机",
+ "frameMonitor": "显示器",
+ "frameNeedsPortrait": "仅限竖屏项目",
+ "windowHelp": "在录制内容周围绘制窗口边框,或以 3D 建模的设备。"
},
"stylePresets": {
"button": "预设",
diff --git a/src/i18n/locales/zh-TW/settings.json b/src/i18n/locales/zh-TW/settings.json
index 007b8f07c..32f61d447 100644
--- a/src/i18n/locales/zh-TW/settings.json
+++ b/src/i18n/locales/zh-TW/settings.json
@@ -122,7 +122,12 @@
"windowNone": "無",
"windowLight": "淺色",
"windowDark": "深色",
- "windowHelp": "在錄製內容周圍繪製視窗標題列和邊框。"
+ "frameBrowser": "瀏覽器",
+ "frameLaptop": "筆記型電腦",
+ "framePhone": "手機",
+ "frameMonitor": "螢幕",
+ "frameNeedsPortrait": "僅限直向專案",
+ "windowHelp": "在錄製內容周圍繪製視窗邊框,或以 3D 建模的裝置。"
},
"stylePresets": {
"button": "預設",
diff --git a/src/lib/ai-edition/store/editorSettings.test.ts b/src/lib/ai-edition/store/editorSettings.test.ts
index 1ec2e046a..af44f5630 100644
--- a/src/lib/ai-edition/store/editorSettings.test.ts
+++ b/src/lib/ai-edition/store/editorSettings.test.ts
@@ -308,9 +308,11 @@ describe("patchEditorSettings", () => {
it("round-trips the recording frame and reads an unknown one as no frame", () => {
expect(getEditorSettings(baseDoc).frame).toBe("none");
- const patched = patchEditorSettings(baseDoc, { frame: "window-dark" });
- expect(getEditorSettings(patched).frame).toBe("window-dark");
- const unknown = { ...baseDoc, legacyEditor: { frame: "browser" } } as typeof baseDoc;
+ for (const frame of ["window-dark", "browser", "laptop", "phone", "monitor"] as const) {
+ const patched = patchEditorSettings(baseDoc, { frame });
+ expect(getEditorSettings(patched).frame).toBe(frame);
+ }
+ const unknown = { ...baseDoc, legacyEditor: { frame: "holo-visor" } } as typeof baseDoc;
expect(getEditorSettings(unknown).frame).toBe("none");
});
diff --git a/src/lib/projectDefaults.ts b/src/lib/projectDefaults.ts
index 2f606a9e7..e50e6c10c 100644
--- a/src/lib/projectDefaults.ts
+++ b/src/lib/projectDefaults.ts
@@ -1,19 +1,60 @@
/**
* The frame drawn around the recording, a project setting like the wallpaper. "none" draws
* nothing and renders exactly as before the setting existed.
+ *
+ * Two families, and the difference is not cosmetic: the window chrome is drawn FLAT in the
+ * screen's own plane (shader mode 14), while the four devices are modelled in real 3D around it
+ * (mode 17) — a body with thickness, a bevel and a bezel, ray-marched in the same camera as the
+ * footage. Which is why the camera can move around them.
*/
-export type RecordingFrame = "none" | "window-light" | "window-dark";
+export type RecordingFrame =
+ | "none"
+ | "window-light"
+ | "window-dark"
+ | "browser"
+ | "laptop"
+ | "phone"
+ | "monitor";
export const RECORDING_FRAMES = [
"none",
"window-light",
"window-dark",
+ "browser",
+ "laptop",
+ "phone",
+ "monitor",
+] as const satisfies readonly RecordingFrame[];
+
+/**
+ * The devices modelled in 3D, in menu order. They are the values that shader mode 17 draws;
+ * everything else is flat.
+ */
+export const DEVICE_FRAMES = [
+ "browser",
+ "laptop",
+ "phone",
+ "monitor",
] as const satisfies readonly RecordingFrame[];
export function isRecordingFrame(value: unknown): value is RecordingFrame {
return typeof value === "string" && (RECORDING_FRAMES as readonly string[]).includes(value);
}
+/**
+ * The phone is the only PORTRAIT device: wrapped around a landscape recording it would read as a
+ * phone held sideways with its screen stretched across, which is not a thing. The picker offers
+ * it only when the output is at least as tall as it is wide, and says so when it does not.
+ *
+ * `null` = the frame is offered. A string = the reason it is not, as an i18n key.
+ */
+export function recordingFrameBlockedReason(
+ frame: RecordingFrame,
+ outputAspect: number,
+): string | null {
+ return frame === "phone" && outputAspect > 1 ? "effects.frameNeedsPortrait" : null;
+}
+
export interface ProjectAppearanceDefaults {
wallpaper: string;
wallpaperMotion: "none" | "drift" | "aurora" | "waves";
diff --git a/src/native/sceneDescription.test.ts b/src/native/sceneDescription.test.ts
index f155af7c2..7c35df2bf 100644
--- a/src/native/sceneDescription.test.ts
+++ b/src/native/sceneDescription.test.ts
@@ -18,6 +18,7 @@ import type {
AxcutZoomRegion,
} from "@/lib/ai-edition/schema";
import { axcutSchemaVersion } from "@/lib/ai-edition/schema";
+import { DEVICE_FRAMES, recordingFrameBlockedReason } from "@/lib/projectDefaults";
import { getFocusBoundsForScale } from "@/lib/zoomMath/focusUtils";
import { buildSceneDescription, wallpaperAcceptsMotion } from "./sceneDescription";
@@ -237,6 +238,28 @@ describe("buildSceneDescription.effects.frame", () => {
const doc = makeDoc({ legacyEditor: { frame: "window-light" } });
expect(buildSceneDescription(doc).effects.frame).toBe("window-light");
});
+
+ // The four devices ride the same field as the window chrome: what changes is which shader
+ // mode the native side picks (17 instead of 14), not the contract.
+ it("carries each modelled device frame", () => {
+ for (const frame of DEVICE_FRAMES) {
+ const doc = makeDoc({ legacyEditor: { frame } });
+ expect(buildSceneDescription(doc).effects.frame).toBe(frame);
+ }
+ });
+});
+
+describe("recordingFrameBlockedReason", () => {
+ it("offers the phone only to a portrait project, and says why when it does not", () => {
+ expect(recordingFrameBlockedReason("phone", 9 / 16)).toBeNull();
+ expect(recordingFrameBlockedReason("phone", 1)).toBeNull();
+ expect(recordingFrameBlockedReason("phone", 16 / 9)).toBe("effects.frameNeedsPortrait");
+ // The landscape devices and the flat window chrome are never blocked.
+ for (const frame of ["none", "window-light", "browser", "laptop", "monitor"] as const) {
+ expect(recordingFrameBlockedReason(frame, 16 / 9)).toBeNull();
+ expect(recordingFrameBlockedReason(frame, 9 / 16)).toBeNull();
+ }
+ });
});
describe("buildSceneDescription.webcamEffect", () => {