Create polished demo videos without editing skills. Mac/Windows/Linux
Preserve configured backgrounds during clip gaps
webadderall55143515470a
diff --git a/src/components/video-editor/VideoPlayback.tsx b/src/components/video-editor/VideoPlayback.tsxindex 966f0c3b..842343dc 100644--- a/src/components/video-editor/VideoPlayback.tsx+++ b/src/components/video-editor/VideoPlayback.tsx@@ -2336,7 +2336,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(style={{width: "100%",aspectRatio: formatAspectRatioForCSS(aspectRatio, nativeAspectRatio),- backgroundColor: "#000000",borderRadius: 0,clipPath: "none",}}@@ -2352,7 +2351,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(loopplaysInlinestyle={{- visibility: isGap ? "hidden" : "visible",filter:sceneEffects.backgroundBlurPx > 0? `blur(${sceneEffects.backgroundBlurPx}px)`@@ -2367,7 +2365,6 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(className="absolute inset-0 bg-cover bg-center"style={{...backgroundStyle,- visibility: isGap ? "hidden" : "visible",filter:sceneEffects.backgroundBlurPx > 0? `blur(${sceneEffects.backgroundBlurPx}px)`diff --git a/src/lib/exporter/frameRenderer.test.ts b/src/lib/exporter/frameRenderer.test.tsindex ba1701e5..fc6339dd 100644--- a/src/lib/exporter/frameRenderer.test.ts+++ b/src/lib/exporter/frameRenderer.test.ts@@ -289,22 +289,23 @@ function createRenderer() {}describe("FrameRenderer webcam export path", () => {- it("renders a timeline gap as solid black", async () => {+ it("composites the background during a gap without source layers", async () => {const renderer = createRenderer();const camera = { visible: true };const context = createMockContext();const app = { stage: {}, renderer: { render: vi.fn() } };+ const composite = vi.fn();Object.assign(renderer, {app,cameraContainer: camera,videoContainer: {},compositeCtx: context,+ compositeWithShadows: composite,});await renderer.renderFrame(null, 0, 0, 33333, 1500000);expect(camera.visible).toBe(false);- expect(context.fillStyle).toBe("#000000");- expect(context.fillRect).toHaveBeenCalledWith(0, 0, 1920, 1080);- expect(app.renderer.render).not.toHaveBeenCalled();+ expect(app.renderer.render).toHaveBeenCalledWith(app.stage);+ expect(composite).toHaveBeenCalledWith(false);});const createdCanvases: ReturnType<typeof createMockCanvas>[] = [];diff --git a/src/lib/exporter/frameRenderer.ts b/src/lib/exporter/frameRenderer.tsindex 349819ec..0749d724 100644--- a/src/lib/exporter/frameRenderer.ts+++ b/src/lib/exporter/frameRenderer.ts@@ -1418,8 +1418,11 @@ export class FrameRenderer {this.cameraContainer.visible = videoFrame !== null;if (!videoFrame) {this.updateAnimationState(backgroundTimelineTimestamp / 1000, cursorTimestamp / 1000);- this.compositeCtx.fillStyle = "#000000";- this.compositeCtx.fillRect(0, 0, this.config.width, this.config.height);+ if (this.backgroundForwardFrameSource || this.backgroundVideoElement) {+ await this.syncBackgroundFrame(backgroundTimelineTimestamp / 1_000_000);+ }+ this.app.renderer.render(this.app.stage);+ this.compositeWithShadows(false);return;}diff --git a/src/lib/exporter/modernFrameRenderer.test.ts b/src/lib/exporter/modernFrameRenderer.test.tsindex c4809ad8..5c473f0e 100644--- a/src/lib/exporter/modernFrameRenderer.test.ts+++ b/src/lib/exporter/modernFrameRenderer.test.ts@@ -202,7 +202,7 @@ function createRenderer() {});}-it("renders a timeline gap as solid black", async () => {+it("renders the background during a timeline gap without source layers", async () => {const renderer = createRenderer();const camera = { visible: true };const output = createMockCanvas();@@ -221,11 +221,9 @@ it("renders a timeline gap as solid black", async () => {});await renderer.renderFrame(null, 0, 0, 33333, 1500000);expect(camera.visible).toBe(false);- expect(output.context.fillStyle).toBe("#000000");- expect(output.context.fillRect).toHaveBeenCalledWith(0, 0, 1920, 1080);+ expect(output.context.fillRect).not.toHaveBeenCalled();expect(annotations).not.toHaveBeenCalled();- expect(renderOutput).not.toHaveBeenCalled();- expect(renderer.getCanvas()).toBe(output);+ expect(renderOutput).toHaveBeenCalledWith(1500);});describe("ModernFrameRenderer Pixi lifecycle", () => {@@ -817,7 +815,7 @@ describe("ModernFrameRenderer webcam export fallback", () => {describe("ModernFrameRenderer frame sequencing", () => {it.each([0, 1,- ])("resumes visual layers after a black gap with temporal blur set to %s", async (temporalBlur) => {+ ])("resumes visual layers after a background gap with temporal blur set to %s", async (temporalBlur) => {const renderer = createRenderer();const sceneCanvas = createMockCanvas();const gapCanvas = createMockCanvas();@@ -865,23 +863,18 @@ describe("ModernFrameRenderer frame sequencing", () => {await renderer.renderFrame(null, 0, 0, 33_333, 1_500_000);expect(updateAnimation).toHaveBeenLastCalledWith(1500, 0);- expect(renderer.getCanvas()).toBe(gapCanvas);+ expect(renderer.getCanvas()).toBe(sceneCanvas);+ expect(render).toHaveBeenCalledTimes(2);+ expect(syncBackground).toHaveBeenCalledTimes(2);expect(camera.visible).toBe(false);- for (const callback of [- render,- syncWebcam,- syncBackground,- updateAnnotations,- updateCaptions,- updateWebcam,- ]) {+ for (const callback of [syncWebcam, updateAnnotations, updateCaptions, updateWebcam]) {expect(callback).toHaveBeenCalledTimes(1);}await renderer.renderFrame({} as VideoFrame, 6_000_000, 6_000_000, 33_333, 2_000_000);expect(renderer.getCanvas()).toBe(sceneCanvas);expect(camera.visible).toBe(true);- expect(render).toHaveBeenCalledTimes(2);+ expect(render).toHaveBeenCalledTimes(3);expect(syncWebcam).toHaveBeenLastCalledWith(6);expect(syncBackground).toHaveBeenLastCalledWith(2);expect(updateAnnotations).toHaveBeenLastCalledWith(2000);diff --git a/src/lib/exporter/modernFrameRenderer.ts b/src/lib/exporter/modernFrameRenderer.tsindex 17841979..40dc9978 100644--- a/src/lib/exporter/modernFrameRenderer.ts+++ b/src/lib/exporter/modernFrameRenderer.ts@@ -2862,11 +2862,12 @@ export class FrameRenderer {this.cameraContainer.visible = videoFrame !== null;if (!videoFrame) {this.updateAnimationState(backgroundTimelineTimestamp / 1000, cursorTimestamp / 1000);- const output = this.ensureExportCompositeCanvas();- if (!output) throw new Error("Failed to create gap frame canvas");- output.context.fillStyle = "#000000";- output.context.fillRect(0, 0, output.canvas.width, output.canvas.height);- this.outputCanvasOverride = output.canvas;+ if (this.backgroundForwardFrameSource || this.backgroundVideoElement) {+ await this.syncBackgroundFrame(backgroundTimelineTimestamp / 1_000_000);+ }+ if (this.webcamRootContainer) this.webcamRootContainer.visible = false;+ if (this.captionContainer) this.captionContainer.visible = false;+ await this.renderOutput(backgroundTimelineTimestamp / 1000);return;}if (this.captionContainer) this.captionContainer.visible = true;