🎥 Make videos programmatically with React
add integration test for rendering some audio with base64 encoding
Jonny Burger251326ac3e78
diff --git a/packages/example/src/AudioTesting/Base64.tsx b/packages/example/src/AudioTesting/Base64.tsxnew file mode 100644index 0000000000..23714e471e--- /dev/null+++ b/packages/example/src/AudioTesting/Base64.tsx@@ -0,0 +1,9 @@+import {Audio} from 'remotion';++const Base64Audio: React.FC = () => {+ return (+ <Audio src="data:audio/mpeg;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV" />+ );+};++export default Base64Audio;diff --git a/packages/example/src/Video.tsx b/packages/example/src/Video.tsxindex eee5992e5f..54e4bedcb9 100644--- a/packages/example/src/Video.tsx+++ b/packages/example/src/Video.tsx@@ -386,6 +386,14 @@ export const Index: React.FC = () => {fps={30}durationInFrames={300}/>+ <Composition+ id="audio-testing-base64"+ lazyComponent={() => import('./AudioTesting/Base64')}+ width={1080}+ height={1080}+ fps={30}+ durationInFrames={300}+ /><Compositionid="audio-visualization"lazyComponent={() => import('./AudioVisualization')}diff --git a/packages/it-tests/src/rendering/base64-audio.test.ts b/packages/it-tests/src/rendering/base64-audio.test.tsnew file mode 100644index 0000000000..416a62a30a--- /dev/null+++ b/packages/it-tests/src/rendering/base64-audio.test.ts@@ -0,0 +1,42 @@+import path from "path";+import fs from "fs";+import execa from "execa";++const outputPath = path.join(process.cwd(), "packages/example/out.mp3");++beforeEach(() => {+ if (fs.existsSync(outputPath)) {+ fs.unlinkSync(outputPath);+ }+});++test("Should be able to render a MP3 audio file", async () => {+ const task = execa(+ "pnpm",+ [+ "exec",+ "remotion",+ "render",+ "src/index.tsx",+ "audio-testing-base64",+ outputPath,+ ],+ {+ cwd: path.join(process.cwd(), "..", "example"),+ }+ );+ task.stderr?.pipe(process.stderr);+ await task;+ const exists = fs.existsSync(outputPath);+ expect(exists).toBe(true);++ const info = await execa("ffprobe", [outputPath]);+ const data = info.stderr;+ expect(data).toContain("mp3");+ expect(data).toContain("stereo");+ expect(data).toContain("fltp");+ expect(data).toContain("320 kb/s");+ expect(data).toContain("Stream #0");+ expect(data).not.toContain("Stream #1");+ fs.unlinkSync(outputPath);+});