Skip to content

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

fix(export): use default wallpaper for native background

wiiiii123c7e38977e5e1
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<string, unknown> = {}) {
videoInfo: DecodedVideoInfo,
effectiveDurationSec: number,
) => string | null;
+ resolveNativeStaticLayoutBackground: () => Promise<unknown>;
};
}
@@ -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<string>;
+ 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<NativeStaticLayoutBackground | null> {
- 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:") ||