🎥 Make videos programmatically with React
fix error and add a test
Jonny Burger485c3ca52581
diff --git a/packages/renderer/src/assets/download-and-map-assets-to-file.ts b/packages/renderer/src/assets/download-and-map-assets-to-file.tsindex 41ebdd3880..88828c0ce2 100644--- a/packages/renderer/src/assets/download-and-map-assets-to-file.ts+++ b/packages/renderer/src/assets/download-and-map-assets-to-file.ts@@ -95,7 +95,7 @@ const downloadAsset = async (if (src.startsWith('data:')) {const [assetDetails, assetData] = src.substring('data:'.length).split(',');- if (!assetData.includes(';')) {+ if (!assetDetails.includes(';')) {const errMessage = ['A data URL was passed but did not have the correct format so that Remotion could convert it for the video to be rendered.','The format of the data URL must be `data:[mime-type];[encoding],[data]`.',diff --git a/tests/rendering.test.ts b/tests/rendering.test.tsindex 5ba72d1a71..dc78fdce32 100644--- a/tests/rendering.test.ts+++ b/tests/rendering.test.ts@@ -262,6 +262,27 @@ test("Should render a video with GIFs", async () => {fs.unlinkSync(outputPath);});+test("Should render a video with Offline Audio-context", async () => {+ const out = outputPath.replace(".mp4", ".mp3");++ const task = await execa(+ "npx",+ ["remotion", "render", "src/index.tsx", "offline-audio-buffer", out],+ {+ cwd: "packages/example",+ reject: false,+ }+ );+ expect(task.exitCode).toBe(0);+ expect(fs.existsSync(out)).toBe(true);++ const info = await execa("ffprobe", [out]);+ const data = info.stderr;+ expect(data).toContain("Stream #0:0: Audio: mp3");+ expect(data).toContain("44100 Hz, stereo");+ fs.unlinkSync(out);+});+test("Should fail to render an audio file that doesn't have any audio inputs", async () => {const out = outputPath.replace(".mp4", ".mp3");const task = await execa(