Skip to content

🎥 Make videos programmatically with React

chore: setup example with multiple audio sources

Arthur Denner8dc2f98d43a0
diff --git a/packages/example/package.json b/packages/example/package.json
index 79e395a362..e3a203bb3c 100644
--- a/packages/example/package.json
+++ b/packages/example/package.json
@@ -10,11 +10,12 @@
"dist"
],
"scripts": {
+ "serve": "npx http-server src/AudioTesting",
"start": "remotion preview src/index.tsx",
"start-js": "remotion preview src/entry.jsx",
"test": "eslint src --ext ts,tsx,js,jsx && jest",
"build": "tsc -d",
- "render": "remotion render src/index.tsx react-svg out/video.mp4",
+ "render": "remotion render src/index.tsx audio-testing video.mp4",
"render-js": "remotion render src/entry.jsx framer out/video.mp4",
"render-transparent": "remotion render src/index.tsx --image-format=png --pixel-format=yuva420p --codec=vp8 react-svg out/video.webm"
},
diff --git a/packages/example/src/AudioTesting/cow-moo.ogg b/packages/example/src/AudioTesting/cow-moo.ogg
new file mode 100644
index 0000000000..365f6364cf
Binary files /dev/null and b/packages/example/src/AudioTesting/cow-moo.ogg differ
diff --git a/packages/example/src/AudioTesting/index.tsx b/packages/example/src/AudioTesting/index.tsx
index 6c03469f66..0cbf8c61f8 100644
--- a/packages/example/src/AudioTesting/index.tsx
+++ b/packages/example/src/AudioTesting/index.tsx
@@ -1,21 +1,21 @@
import {Audio, interpolate, Sequence} from 'remotion';
-import music from './music.mp3';
const AudioTesting: React.FC = () => {
return (
<div>
- <Sequence from={100} durationInFrames={100}>
+ <Sequence from={50} durationInFrames={100}>
<Audio
- startFrom={100}
- endAt={200}
- src={music}
volume={(f) =>
interpolate(f, [0, 50, 100], [0, 1, 0], {
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
})
}
- />
+ >
+ {/* Serve this assets with `npm run serve` in the `example` folder */}
+ <source src="http://127.0.0.1:8080/cow-moo.ogg" type="audio/ogg" />
+ <source src="http://127.0.0.1:8080/kid-laugh.mp3" type="audio/mpeg" />
+ </Audio>
</Sequence>
</div>
);
diff --git a/packages/example/src/AudioTesting/kid-laugh.mp3 b/packages/example/src/AudioTesting/kid-laugh.mp3
new file mode 100644
index 0000000000..5f88d5ff95
Binary files /dev/null and b/packages/example/src/AudioTesting/kid-laugh.mp3 differ
diff --git a/packages/example/src/Video.tsx b/packages/example/src/Video.tsx
index 92e64abe4c..1428cc4362 100644
--- a/packages/example/src/Video.tsx
+++ b/packages/example/src/Video.tsx
@@ -161,7 +161,7 @@ export const Index: React.FC = () => {
width={1080}
height={1080}
fps={30}
- durationInFrames={300}
+ durationInFrames={150}
/>
<Composition
id="audio-visualization"