🎥 Make videos programmatically with React
test legacy SSR API
Jonny Burgera58fad393274
diff --git a/tests/ssr/render-frames.test.ts b/tests/ssr/render-frames.test.tsnew file mode 100644index 0000000000..f1e5461132--- /dev/null+++ b/tests/ssr/render-frames.test.ts@@ -0,0 +1,63 @@+import fs from "fs";+import os from "os";+import path from "path";+import {+ getCompositions,+ openBrowser,+ renderFrames,+ stitchFramesToVideo,+} from "@remotion/renderer";+import execa from "execa";++test("Legacy SSR way or rendering videos should still work", async () => {+ const puppeteerInstance = await openBrowser("chrome");+ const compositions = await getCompositions(+ "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html",+ {+ puppeteerInstance,+ }+ );++ const reactSvg = compositions.find((c) => c.id === "react-svg");++ if (!reactSvg) {+ throw new Error("not found");+ }++ const tmpDir = os.tmpdir();++ // We create a temporary directory for storing the frames+ const framesDir = await fs.promises.mkdtemp(+ path.join(os.tmpdir(), "remotion-")+ );++ const outPath = path.join(tmpDir, "out.mp4");++ const { assetsInfo } = await renderFrames({+ config: reactSvg,+ imageFormat: "jpeg",+ inputProps: {},+ onFrameUpdate: () => undefined,+ webpackBundle:+ "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html",+ parallelism: null,+ frameRange: [0, 10],+ outputDir: framesDir,+ onStart: () => undefined,+ });++ await stitchFramesToVideo({+ dir: framesDir,+ assetsInfo,+ force: true,+ fps: reactSvg.fps,+ height: reactSvg.height,+ outputLocation: outPath,+ width: reactSvg.width,+ codec: "h264",+ });+ expect(fs.existsSync(outPath)).toBe(true);+ const probe = await execa("ffprobe", [outPath]);+ expect(probe.stderr).toMatch(/Video: h264/);+ await puppeteerInstance.close();+});