Skip to content

🎥 Make videos programmatically with React

better docs

Jonny Burgerc23ea28945ec
diff --git a/packages/docs/docs/contributing/index.mdx b/packages/docs/docs/contributing/index.mdx
index 40b0ae1fa1..d6f0f7a61a 100644
--- a/packages/docs/docs/contributing/index.mdx
+++ b/packages/docs/docs/contributing/index.mdx
@@ -22,7 +22,6 @@ This project is released with a [Contributor Code of Conduct](https://remotion.d
<code>pnpm</code> v8.10.2
</a> as the package manager for development in this repository. We recommend using
Corepack so you get the same version of pnpm as we have. <br />
-<br />
```sh
corepack enable
@@ -41,7 +40,6 @@ We use [Bun](https://bun.sh) to speed up some parts of the build.
Install at least Bun 1.1.7 on your system - see https://bun.sh/ for instructions.
<Step>2</Step> Clone the Remotion repository:
-<br />
```sh
git clone --depth=1 https://github.com/remotion-dev/remotion.git && cd remotion
@@ -52,14 +50,12 @@ The full Git history of Remotion is large. To save time and disk space, we recom
:::
<Step>3</Step> Install all dependencies:
-<br />
```sh
pnpm i
```
<Step>4</Step> Build the project initially:
-<br />
```sh
pnpm build
diff --git a/packages/docs/docs/media-parser/parse-media.mdx b/packages/docs/docs/media-parser/parse-media.mdx
index 8a84771d04..0e3259d099 100644
--- a/packages/docs/docs/media-parser/parse-media.mdx
+++ b/packages/docs/docs/media-parser/parse-media.mdx
@@ -159,6 +159,7 @@ The `sample` has the type `AudioSample` and while not all fields are stable, it
```tsx twoslash title="Reading audio frames"
// @module: es2022
// @target: es2017
+// @noErrors
import {parseMedia, OnAudioTrack} from '@remotion/media-parser';
const onAudioTrack: OnAudioTrack = (track) => {
diff --git a/packages/docs/docs/media-parser/web-file-reader.mdx b/packages/docs/docs/media-parser/web-file-reader.mdx
index ab5f0afd0b..a2d392d6ac 100644
--- a/packages/docs/docs/media-parser/web-file-reader.mdx
+++ b/packages/docs/docs/media-parser/web-file-reader.mdx
@@ -20,17 +20,24 @@ Useful if you want to parse a video from a `<input type="file">` element.
```tsx twoslash title="Reading a local file"
// @module: es2022
// @target: es2017
+import React, {useCallback} from 'react';
import {parseMedia} from '@remotion/media-parser';
import {webFileReader} from '@remotion/media-parser/web-file';
-const onFile = async (file: File) => {
- const result = await parseMedia({
- src: '/Users/jonnyburger/Downloads/my-video.mp4',
- fields: {
- durationInSeconds: true,
- dimensions: true,
- },
- reader: webFileReader,
- });
-};
+const MyComp: React.FC = () => {
+ const onFile = useCallback(async (file: File) => {
+ const result = await parseMedia({
+ src: file,
+ fields: {
+ durationInSeconds: true,
+ dimensions: true,
+ },
+ reader: webFileReader,
+ });
+ }, []);
+
+ return (
+ <input type="file" onChange={(e) => onFile(e.target.files?.[0]!)} />
+ );
+}
```