🎥 Make videos programmatically with React
fix errors
Jonny Burger628a91ad6b8b
diff --git a/packages/docs/docs/dataset-render.md b/packages/docs/docs/dataset-render.mdindex 2b12b93d57..349c868777 100644--- a/packages/docs/docs/dataset-render.md+++ b/packages/docs/docs/dataset-render.md@@ -248,6 +248,8 @@ const composition = {fps: 30,durationInFrames: 30,id: "hi",+ defaultProps: {},+ props: {},};const bundleLocation = "xxx";// ---cut---diff --git a/packages/docs/docs/passing-props.md b/packages/docs/docs/passing-props.mdindex 8e76f29f40..a10b529e1c 100644--- a/packages/docs/docs/passing-props.md+++ b/packages/docs/docs/passing-props.md@@ -111,6 +111,7 @@ const composition = {height: 1080,id: "my-video",defaultProps: {},+ props: {},};const serveUrl = "/path/to/bundle";const outputLocation = "/path/to/frames";diff --git a/packages/docs/docs/renderer/make-cancel-signal.md b/packages/docs/docs/renderer/make-cancel-signal.mdindex 6960862139..24c33abf75 100644--- a/packages/docs/docs/renderer/make-cancel-signal.md+++ b/packages/docs/docs/renderer/make-cancel-signal.md@@ -16,13 +16,14 @@ This function returns a signal and a cancel function that allows to you cancel a// @module: ESNext// @target: ESNextimport { TCompMetadata } from "remotion";-const composition: TCompMetadata<any, any> = {+const composition = {durationInFrames: 1000000,fps: 30,height: 720,id: "react-svg",width: 1280,defaultProps: {},+ props: {},};// ---cut---import { makeCancelSignal, renderMedia } from "@remotion/renderer";diff --git a/packages/it-tests/src/ssr/cancel-after-success.test.ts b/packages/it-tests/src/ssr/cancel-after-success.test.tsindex 0b9536255c..845e16b455 100644--- a/packages/it-tests/src/ssr/cancel-after-success.test.ts+++ b/packages/it-tests/src/ssr/cancel-after-success.test.ts@@ -8,14 +8,15 @@ test("Cancelling after success should not throw error", async () => {const outputLocation = "out/render.mp4";await renderMedia({codec: "h264",- serveUrl:- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ serveUrl: "https://shimmering-youtiao-218c24.netlify.app/",composition: {durationInFrames: 4,fps: 30,height: 720,id: "react-svg",width: 1280,+ defaultProps: {},+ props: {},},concurrency: 1,outputLocation,diff --git a/packages/it-tests/src/ssr/cancel-renderframes.test.ts b/packages/it-tests/src/ssr/cancel-renderframes.test.tsindex db29688587..9729399db4 100644--- a/packages/it-tests/src/ssr/cancel-renderframes.test.ts+++ b/packages/it-tests/src/ssr/cancel-renderframes.test.ts@@ -5,14 +5,15 @@ test("Should be able to cancel render", async () => {try {const { cancel, cancelSignal } = makeCancelSignal();const val = renderFrames({- serveUrl:- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ serveUrl: "https://shimmering-youtiao-218c24.netlify.app/",composition: {durationInFrames: 1000000,fps: 30,height: 720,id: "react-svg",width: 1280,+ defaultProps: {},+ props: {},},cancelSignal,imageFormat: "jpeg",diff --git a/packages/it-tests/src/ssr/cancel-rendermedia.test.ts b/packages/it-tests/src/ssr/cancel-rendermedia.test.tsindex 20642d6941..cd3948ccc2 100644--- a/packages/it-tests/src/ssr/cancel-rendermedia.test.ts+++ b/packages/it-tests/src/ssr/cancel-rendermedia.test.ts@@ -6,14 +6,15 @@ test("Should be able to cancel render", async () => {const { cancel, cancelSignal } = makeCancelSignal();const val = renderMedia({codec: "h264",- serveUrl:- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ serveUrl: "https://shimmering-youtiao-218c24.netlify.app/",composition: {durationInFrames: 1000000,fps: 30,height: 720,id: "react-svg",width: 1280,+ defaultProps: {},+ props: {},},outputLocation: "out/render.mp4",cancelSignal,diff --git a/packages/it-tests/src/ssr/cancel-renderstill.test.ts b/packages/it-tests/src/ssr/cancel-renderstill.test.tsindex 628d5e7953..2d8a82b1e9 100644--- a/packages/it-tests/src/ssr/cancel-renderstill.test.ts+++ b/packages/it-tests/src/ssr/cancel-renderstill.test.ts@@ -5,14 +5,15 @@ test("Should be able to cancel render", async () => {try {const { cancel, cancelSignal } = makeCancelSignal();const val = renderStill({- serveUrl:- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ serveUrl: "https://shimmering-youtiao-218c24.netlify.app/",composition: {durationInFrames: 1000000,fps: 30,height: 720,id: "react-svg",width: 1280,+ defaultProps: {},+ props: {},},cancelSignal,output: "out/hithere.png",diff --git a/packages/it-tests/src/ssr/fatal-error-correct-error.test.ts b/packages/it-tests/src/ssr/fatal-error-correct-error.test.tsindex 9a2dfb0d0f..5d84b7ffef 100644--- a/packages/it-tests/src/ssr/fatal-error-correct-error.test.ts+++ b/packages/it-tests/src/ssr/fatal-error-correct-error.test.ts@@ -5,14 +5,15 @@ test("Fatal error on frame 10 should yield correct error", async () => {await expect(() => {return renderMedia({codec: "h264",- serveUrl:- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ serveUrl: "https://shimmering-youtiao-218c24.netlify.app/",composition: {durationInFrames: 1000000,fps: 30,height: 720,id: "error-on-frame-10",width: 1280,+ defaultProps: {},+ props: {},},outputLocation: "out/render.mp4",});diff --git a/packages/it-tests/src/ssr/render-frames.test.ts b/packages/it-tests/src/ssr/render-frames.test.tsindex d261ee666c..b1ff46998d 100644--- a/packages/it-tests/src/ssr/render-frames.test.ts+++ b/packages/it-tests/src/ssr/render-frames.test.ts@@ -13,7 +13,7 @@ import { RenderInternals } from "@remotion/renderer";test("Legacy SSR way of rendering videos should still work", async () => {const puppeteerInstance = await openBrowser("chrome");const compositions = await getCompositions(- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ "https://shimmering-youtiao-218c24.netlify.app/",{puppeteerInstance,}@@ -39,8 +39,7 @@ test("Legacy SSR way of rendering videos should still work", async () => {imageFormat: "jpeg",inputProps: {},onFrameUpdate: () => undefined,- serveUrl:- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ serveUrl: "https://shimmering-youtiao-218c24.netlify.app/",concurrency: null,frameRange: [0, 10],outputDir: framesDir,@@ -62,5 +61,5 @@ test("Legacy SSR way of rendering videos should still work", async () => {expect(probe.stderr).toMatch(/Video: h264/);RenderInternals.deleteDirectory(framesDir);- await puppeteerInstance.close(false);+ await puppeteerInstance.close(false, "info", false);});diff --git a/packages/it-tests/src/ssr/render-media.test.ts b/packages/it-tests/src/ssr/render-media.test.tsindex d484f90fce..d20a9ea027 100644--- a/packages/it-tests/src/ssr/render-media.test.ts+++ b/packages/it-tests/src/ssr/render-media.test.ts@@ -7,7 +7,7 @@ import { expect, test } from "vitest";test("Render video with browser instance open", async () => {const puppeteerInstance = await openBrowser("chrome");const compositions = await getCompositions(- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ "https://shimmering-youtiao-218c24.netlify.app/",{puppeteerInstance,}@@ -26,19 +26,18 @@ test("Render video with browser instance open", async () => {await renderMedia({outputLocation: outPath,codec: "h264",- serveUrl:- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ serveUrl: "https://shimmering-youtiao-218c24.netlify.app/",composition: reactSvg,frameRange: [0, 2],puppeteerInstance,});- await puppeteerInstance.close(false);+ await puppeteerInstance.close(false, "info", false);expect(existsSync(outPath)).toBe(true);});test("Render video with browser instance not open", async () => {const compositions = await getCompositions(- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/"+ "https://shimmering-youtiao-218c24.netlify.app/");const reactSvg = compositions.find((c) => c.id === "react-svg");@@ -54,8 +53,7 @@ test("Render video with browser instance not open", async () => {await renderMedia({outputLocation: outPath,codec: "h264",- serveUrl:- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ serveUrl: "https://shimmering-youtiao-218c24.netlify.app/",composition: reactSvg,frameRange: [0, 2],});@@ -72,8 +70,7 @@ test("should fail on invalid CRF", async () => {await renderMedia({outputLocation: outPath,codec: "h264",- serveUrl:- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ serveUrl: "https://shimmering-youtiao-218c24.netlify.app/",// @ts-expect-errorcrf: "wrong",config: {@@ -93,12 +90,12 @@ test("should fail on invalid CRF", async () => {);}- await browserInstance.close(false);+ await browserInstance.close(false, "info", false);});test("Render video to a buffer", async () => {const compositions = await getCompositions(- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/"+ "https://shimmering-youtiao-218c24.netlify.app/");const reactSvg = compositions.find((c) => c.id === "react-svg");@@ -109,8 +106,7 @@ test("Render video to a buffer", async () => {const { buffer } = await renderMedia({codec: "h264",- serveUrl:- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ serveUrl: "https://shimmering-youtiao-218c24.netlify.app/",composition: reactSvg,frameRange: [0, 2],});diff --git a/packages/it-tests/src/ssr/render-still.test.ts b/packages/it-tests/src/ssr/render-still.test.tsindex 7c21d9f79f..4a0fba6d7c 100644--- a/packages/it-tests/src/ssr/render-still.test.ts+++ b/packages/it-tests/src/ssr/render-still.test.ts@@ -16,7 +16,7 @@ afterEach(async () => {test("Render video with browser instance open", async () => {const puppeteerInstance = await openBrowser("chrome");const compositions = await getCompositions(- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ "https://shimmering-youtiao-218c24.netlify.app/",{puppeteerInstance,}@@ -34,18 +34,17 @@ test("Render video with browser instance open", async () => {const { buffer } = await renderStill({output: outPath,- serveUrl:- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ serveUrl: "https://shimmering-youtiao-218c24.netlify.app/",composition: reactSvg,puppeteerInstance,});expect(buffer).toBe(null);- await puppeteerInstance.close(false);+ await puppeteerInstance.close(false, "info", false);});test("Render still with browser instance not open and legacy webpack config", async () => {const compositions = await getCompositions(- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/"+ "https://shimmering-youtiao-218c24.netlify.app/");const reactSvg = compositions.find((c) => c.id === "react-svg");@@ -60,8 +59,7 @@ test("Render still with browser instance not open and legacy webpack config", asawait renderStill({output: outPath,- serveUrl:- "https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/",+ serveUrl: "https://shimmering-youtiao-218c24.netlify.app/",composition: reactSvg,});expect(existsSync(outPath)).toBe(true);diff --git a/packages/lambda/src/test/integration/renders/gif.test.ts b/packages/lambda/src/test/integration/renders/gif.test.tsindex 32920c92c4..75f5034b06 100644--- a/packages/lambda/src/test/integration/renders/gif.test.ts+++ b/packages/lambda/src/test/integration/renders/gif.test.ts@@ -34,8 +34,7 @@ test('Should make a distributed GIF', async () => {const res = (await handler({type: LambdaRoutines.start,- serveUrl:- 'https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/',+ serveUrl: 'https://shimmering-youtiao-218c24.netlify.app/',chromiumOptions: {},codec: 'gif',composition: 'framer',diff --git a/packages/lambda/src/test/integration/renders/other-bucket.test.ts b/packages/lambda/src/test/integration/renders/other-bucket.test.tsindex 0b0ed6174a..b99789b92a 100644--- a/packages/lambda/src/test/integration/renders/other-bucket.test.ts+++ b/packages/lambda/src/test/integration/renders/other-bucket.test.ts@@ -33,8 +33,7 @@ test('Should be able to render to another bucket', async () => {const res = (await handler({type: LambdaRoutines.start,- serveUrl:- 'https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/',+ serveUrl: 'https://shimmering-youtiao-218c24.netlify.app/',chromiumOptions: {},codec: 'h264',composition: 'react-svg',diff --git a/packages/lambda/src/test/integration/renders/silent-audio.test.ts b/packages/lambda/src/test/integration/renders/silent-audio.test.tsindex 11e334f610..3bdf69bd1e 100644--- a/packages/lambda/src/test/integration/renders/silent-audio.test.ts+++ b/packages/lambda/src/test/integration/renders/silent-audio.test.ts@@ -33,8 +33,7 @@ test('Should add silent audio if there is no audio', async () => {const res = (await handler({type: LambdaRoutines.start,- serveUrl:- 'https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/',+ serveUrl: 'https://shimmering-youtiao-218c24.netlify.app/',chromiumOptions: {},codec: 'h264',composition: 'react-svg',diff --git a/packages/lambda/src/test/integration/renders/transparent-webm.test.ts b/packages/lambda/src/test/integration/renders/transparent-webm.test.tsindex 320fb343a9..03d7f9dd2b 100644--- a/packages/lambda/src/test/integration/renders/transparent-webm.test.ts+++ b/packages/lambda/src/test/integration/renders/transparent-webm.test.ts@@ -36,8 +36,7 @@ test('Should make a transparent video', async () => {const res = (await handler({type: LambdaRoutines.start,- serveUrl:- 'https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/',+ serveUrl: 'https://shimmering-youtiao-218c24.netlify.app/',chromiumOptions: {},codec: 'vp8',composition: 'ten-frame-tester',diff --git a/packages/lambda/src/test/integration/webhooks.test.ts b/packages/lambda/src/test/integration/webhooks.test.tsindex c46dd9ed21..94697b0f67 100644--- a/packages/lambda/src/test/integration/webhooks.test.ts+++ b/packages/lambda/src/test/integration/webhooks.test.ts@@ -69,8 +69,7 @@ describe('Webhooks', () => {const res = await handler({type: LambdaRoutines.start,- serveUrl:- 'https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/',+ serveUrl: 'https://shimmering-youtiao-218c24.netlify.app/',chromiumOptions: {},codec: 'h264',composition: 'react-svg',@@ -155,8 +154,7 @@ describe('Webhooks', () => {await handler({type: LambdaRoutines.launch,- serveUrl:- 'https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/',+ serveUrl: 'https://shimmering-youtiao-218c24.netlify.app/',chromiumOptions: {},codec: 'h264',composition: 'react-svg',diff --git a/packages/renderer/src/test/render-still.test.ts b/packages/renderer/src/test/render-still.test.tsindex a95ce3f8e1..79a5b7b69b 100644--- a/packages/renderer/src/test/render-still.test.ts+++ b/packages/renderer/src/test/render-still.test.ts@@ -15,8 +15,7 @@ test('Need to pass valid metadata', async () => {},frame: 0,output: '/file/output.png',- serveUrl:- 'https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/',+ serveUrl: 'https://shimmering-youtiao-218c24.netlify.app/',verbose: false,})).rejects.toThrow(/not be NaN, but is NaN/);@@ -34,8 +33,7 @@ test('Returns buffer in promise result', async () => {props: {},},frame: 0,- serveUrl:- 'https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/',+ serveUrl: 'https://shimmering-youtiao-218c24.netlify.app/',verbose: false,});expect(buffer?.length).toBeGreaterThan(1000);@@ -55,8 +53,7 @@ test('Need to pass valid metadata', async () => {},frame: 200,output: '/file/output.png',- serveUrl:- 'https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/',+ serveUrl: 'https://shimmering-youtiao-218c24.netlify.app/',verbose: false,})).rejects.toThrow(@@ -80,8 +77,7 @@ test('Catches invalid image format', () => {imageFormat: 'jjj',frame: 200,output: '/file/output.png',- serveUrl:- 'https://64804c64f424474c4b192d49--sage-sable-226d60.netlify.app/',+ serveUrl: 'https://shimmering-youtiao-218c24.netlify.app/',})).rejects.toThrow(/Image format should be one of: "png", "jpeg", "pdf", "webp"/