diff --git a/src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts b/src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts index c97af08a..1bbd93e2 100644 --- a/src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts +++ b/src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts @@ -53,6 +53,7 @@ function createExporter(overrides: Record = {}) { videoInfo: DecodedVideoInfo, effectiveDurationSec: number, ) => string | null; + resolveNativeStaticLayoutBackground: () => Promise; }; } @@ -190,6 +191,24 @@ describe("ModernVideoExporter native static-layout eligibility", () => { ).toBeNull(); }); + it("uses the default wallpaper for native static-layout when the project has no wallpaper", async () => { + const exporter = createExporter({ wallpaper: "" }); + const electronAPI = window.electronAPI as typeof window.electronAPI & { + getAssetBasePath: () => Promise; + listAssetDirectory: () => Promise<{ success: true; files: string[] }>; + }; + electronAPI.getAssetBasePath = vi.fn(async () => "file:///C:/Recordly/resources/"); + electronAPI.listAssetDirectory = vi.fn(async () => ({ + success: true, + files: ["tahoe-light.jpg"], + })); + + await expect(exporter.resolveNativeStaticLayoutBackground()).resolves.toEqual({ + backgroundColor: "#101010", + backgroundImagePath: "C:/Recordly/resources/wallpapers/tahoe-light.jpg", + }); + }); + it("allows non-tail trim timelines with native static-layout", () => { const exporter = createExporter({ trimRegions: [{ id: "trim-1", startMs: 10_000, endMs: 12_000 }], diff --git a/src/lib/exporter/modernVideoExporter.ts b/src/lib/exporter/modernVideoExporter.ts index 0ccb0702..52620011 100644 --- a/src/lib/exporter/modernVideoExporter.ts +++ b/src/lib/exporter/modernVideoExporter.ts @@ -40,7 +40,11 @@ import { } from "@/components/video-editor/webcamOverlay"; import { extensionHost } from "@/lib/extensions"; import { getEffectiveVideoStreamDurationSeconds } from "@/lib/mediaTiming"; -import { DEFAULT_WALLPAPER_RELATIVE_PATH, isVideoWallpaperSource } from "@/lib/wallpapers"; +import { + DEFAULT_WALLPAPER_PATH, + DEFAULT_WALLPAPER_RELATIVE_PATH, + isVideoWallpaperSource, +} from "@/lib/wallpapers"; import { AudioProcessor, isAacAudioEncodingSupported } from "./audioEncoder"; import { getDefaultLightningRenderBackend, @@ -1261,7 +1265,8 @@ export class ModernVideoExporter { } private async resolveNativeStaticLayoutBackground(): Promise { - const wallpaper = this.config.wallpaper?.trim() ?? ""; + const configuredWallpaper = this.config.wallpaper?.trim() ?? ""; + const wallpaper = configuredWallpaper || DEFAULT_WALLPAPER_PATH; if (/^#?[0-9a-f]{6}$/i.test(wallpaper)) { return { backgroundColor: wallpaper.startsWith("#") ? wallpaper : `#${wallpaper}`, @@ -1270,7 +1275,6 @@ export class ModernVideoExporter { } if ( - !wallpaper || isVideoWallpaperSource(wallpaper) || wallpaper.startsWith("data:") || wallpaper.startsWith("blob:") ||