Skip to content

🎥 Make videos programmatically with React

preload

Jonny Burger75dfe07e9779
diff --git a/packages/docs/components/TableOfContents/api.tsx b/packages/docs/components/TableOfContents/api.tsx
index f0d4e0d724..ed2a0f8f79 100644
--- a/packages/docs/components/TableOfContents/api.tsx
+++ b/packages/docs/components/TableOfContents/api.tsx
@@ -32,6 +32,14 @@ export const TableOfContents: React.FC = () => {
<strong>@remotion/bundler</strong>
<div>Create a Webpack bundle from Node.JS</div>
</TOCItem>
+ <TOCItem link="/docs/player">
+ <strong>@remotion/player</strong>
+ <div>Play a Remotion video in the browser</div>
+ </TOCItem>
+ <TOCItem link="/docs/lambda">
+ <strong>@remotion/lambda</strong>
+ <div>Render videos and stills on AWS Lambda</div>
+ </TOCItem>
<TOCItem link="/docs/gif">
<strong>@remotion/gif</strong>
<div>Include a GIF in your video</div>
@@ -40,14 +48,6 @@ export const TableOfContents: React.FC = () => {
<strong>@remotion/media-utils</strong>
<div>Obtain info about video and audio</div>
</TOCItem>
- <TOCItem link="/docs/lambda">
- <strong>@remotion/lambda</strong>
- <div>Render videos and stills on AWS Lambda</div>
- </TOCItem>
- <TOCItem link="/docs/player">
- <strong>@remotion/player</strong>
- <div>Play a Remotion video in the browser</div>
- </TOCItem>
<TOCItem link="/docs/three">
<strong>@remotion/three</strong>
<div>Create 3D videos using React Three Fiber</div>
diff --git a/packages/docs/components/TableOfContents/cli.tsx b/packages/docs/components/TableOfContents/cli.tsx
new file mode 100644
index 0000000000..920ce0731a
--- /dev/null
+++ b/packages/docs/components/TableOfContents/cli.tsx
@@ -0,0 +1,44 @@
+import React from "react";
+import { Grid } from "./Grid";
+import { TOCItem } from "./TOCItem";
+
+export const TableOfContents: React.FC = () => {
+ return (
+ <div>
+ <Grid>
+ <TOCItem link="/docs/cli/preview">
+ <strong>preview</strong>
+ <div>Start the Remotion Preview Server</div>
+ </TOCItem>
+ <TOCItem link="/docs/cli/render">
+ <strong>render</strong>
+ <div>Render video or audio</div>
+ </TOCItem>
+ <TOCItem link="/docs/cli/still">
+ <strong>still</strong>
+ <div>Render a still image</div>
+ </TOCItem>
+ <TOCItem link="/docs/cli/compositions">
+ <strong>compositions</strong>
+ <div>List available compositions</div>
+ </TOCItem>
+ <TOCItem link="/docs/cli/lambda">
+ <strong>lambda</strong>
+ <div>Control Remotion Lambda</div>
+ </TOCItem>
+ <TOCItem link="/docs/cli/versions">
+ <strong>versions</strong>
+ <div>List and validate Remotion package versions</div>
+ </TOCItem>
+ <TOCItem link="/docs/cli/upgrade">
+ <strong>upgrade</strong>
+ <div>Upgrade to a newer version</div>
+ </TOCItem>
+ <TOCItem link="/docs/cli/help">
+ <strong>help</strong>
+ <div>Show CLI commands</div>
+ </TOCItem>
+ </Grid>
+ </div>
+ );
+};
diff --git a/packages/docs/components/TableOfContents/media-utils.tsx b/packages/docs/components/TableOfContents/media-utils.tsx
new file mode 100644
index 0000000000..a6a833b713
--- /dev/null
+++ b/packages/docs/components/TableOfContents/media-utils.tsx
@@ -0,0 +1,42 @@
+import React from "react";
+import { Grid } from "./Grid";
+import { TOCItem } from "./TOCItem";
+
+export const TableOfContents: React.FC = () => {
+ return (
+ <div>
+ <Grid>
+ <TOCItem link="/docs/audio-buffer-to-data-url">
+ <strong>audioBufferToDataUrl()</strong>
+ <div>Serialize an audio buffer</div>
+ </TOCItem>
+ <TOCItem link="/docs/get-audio-data">
+ <strong>getAudioData()</strong>
+ <div>Get metadata of an audio source</div>
+ </TOCItem>
+ <TOCItem link="/docs/get-audio-duration-in-seconds">
+ <strong>getAudioDurationInSeconds()</strong>
+ <div>Get the duration of an audio source</div>
+ </TOCItem>
+ <TOCItem link="/docs/get-video-metadata">
+ <strong>getVideoMetadata()</strong>
+ <div>Get metadata of a video source</div>
+ </TOCItem>
+ <TOCItem link="/docs/get-waveform-portion">
+ <strong>getWaveformPortion()</strong>
+ <div>Trims audio data into a waveform</div>
+ </TOCItem>
+ <TOCItem link="/docs/use-audio-data">
+ <strong>useAudioData()</strong>
+ <div>
+ <code>getAudioData()</code> as a hook
+ </div>
+ </TOCItem>
+ <TOCItem link="/docs/visualize-audio">
+ <strong>visualizeAudio()</strong>
+ <div>Processes a waveform for visualization</div>
+ </TOCItem>
+ </Grid>
+ </div>
+ );
+};
diff --git a/packages/docs/components/TableOfContents/preload.tsx b/packages/docs/components/TableOfContents/preload.tsx
new file mode 100644
index 0000000000..f4de641e17
--- /dev/null
+++ b/packages/docs/components/TableOfContents/preload.tsx
@@ -0,0 +1,24 @@
+import React from "react";
+import { Grid } from "./Grid";
+import { TOCItem } from "./TOCItem";
+
+export const TableOfContents: React.FC = () => {
+ return (
+ <div>
+ <Grid>
+ <TOCItem link="/docs/preload/preload-video">
+ <strong>preloadVideo()</strong>
+ <div>Preload a video source</div>
+ </TOCItem>
+ <TOCItem link="/docs/preload/preload-audio">
+ <strong>preloadAudio()</strong>
+ <div>Preload an audio source</div>
+ </TOCItem>
+ <TOCItem link="/docs/preload/preload-audio">
+ <strong>resolveRedirect()</strong>
+ <div>Get the definitive URL after all redirects</div>
+ </TOCItem>
+ </Grid>
+ </div>
+ );
+};
diff --git a/packages/docs/components/TableOfContents/renderer.tsx b/packages/docs/components/TableOfContents/renderer.tsx
new file mode 100644
index 0000000000..fe5299b084
--- /dev/null
+++ b/packages/docs/components/TableOfContents/renderer.tsx
@@ -0,0 +1,40 @@
+import React from "react";
+import { Grid } from "./Grid";
+import { TOCItem } from "./TOCItem";
+
+export const TableOfContents: React.FC = () => {
+ return (
+ <div>
+ <Grid>
+ <TOCItem link="/docs/renderer/get-compositions">
+ <strong>getCompositions()</strong>
+ <div>List available compositions</div>
+ </TOCItem>
+ <TOCItem link="/docs/renderer/render-media">
+ <strong>renderMedia()</strong>
+ <div>Render a video or audio</div>
+ </TOCItem>
+ <TOCItem link="/docs/renderer/render-frames">
+ <strong>renderFrames()</strong>
+ <div>Render a series of images</div>
+ </TOCItem>
+ <TOCItem link="/docs/renderer/render-still">
+ <strong>renderStill()</strong>
+ <div>Render a single image</div>
+ </TOCItem>
+ <TOCItem link="/docs/renderer/stitch-frames-to-video">
+ <strong>stitchFramesToVideo()</strong>
+ <div>Turn images into a video</div>
+ </TOCItem>
+ <TOCItem link="/docs/renderer/open-browser">
+ <strong>openBrowser()</strong>
+ <div>Open a Chrome browser to reuse across renders</div>
+ </TOCItem>
+ <TOCItem link="/docs/renderer/make-cancel-signal">
+ <strong>makeCancelSignal()</strong>
+ <div>Create token to later cancel a render</div>
+ </TOCItem>
+ </Grid>
+ </div>
+ );
+};
diff --git a/packages/docs/docs/cli/cli.md b/packages/docs/docs/cli/cli.md
index 02800e289d..15da731827 100644
--- a/packages/docs/docs/cli/cli.md
+++ b/packages/docs/docs/cli/cli.md
@@ -5,6 +5,7 @@ id: cli
---
import {AngleChangelog} from '../../components/AngleChangelog';
+import {TableOfContents} from '../../components/TableOfContents/cli';
## How to use
@@ -15,13 +16,7 @@ import {AngleChangelog} from '../../components/AngleChangelog';
The following commands are available - you can always run them using `npx remotion` or even without the `npx` prefix if you put the command inside an npm script.
-- [`npx remotion preview`](/docs/cli/preview)
-- [`npx remotion render`](/docs/cli/render)
-- [`npx remotion still`](/docs/cli/still)
-- [`npx remotion compositions`](/docs/cli/compositions)
-- [`npx remotion upgrade`](/docs/cli/upgrade)
-- [`npx remotion versions`](/docs/cli/versions)
-- [`npx remotion lambda`](/docs/lambda/cli)
+<TableOfContents />
## Example command
diff --git a/packages/docs/docs/media-utils/index.md b/packages/docs/docs/media-utils/index.md
index dfe5247c39..481de27213 100644
--- a/packages/docs/docs/media-utils/index.md
+++ b/packages/docs/docs/media-utils/index.md
@@ -2,6 +2,8 @@
title: "@remotion/media-utils"
---
+import {TableOfContents} from '../../components/TableOfContents/media-utils';
+
A package providing utility functions for getting information about video and audio, and for visualizing audio.
Except for [`useAudioData()`](/docs/use-audio-data), all functions can also be used outside of Remotion.
@@ -44,13 +46,7 @@ yarn add @remotion/media-utils
## Functions
-- [`audioBufferToDataUrl()`](/docs/audio-buffer-to-data-url)
-- [`getAudioData()`](/docs/get-audio-data)
-- [`getAudioDurationInSeconds()`](/docs/get-audio-duration-in-seconds)
-- [`getVideoMetadata()`](/docs/get-video-metadata)
-- [`getWaveformPortion()`](/docs/get-waveform-portion)
-- [`useAudioData()`](/docs/use-audio-data)
-- [`visualizeAudio()`](/docs/visualize-audio)
+<TableOfContents />
## License
diff --git a/packages/docs/docs/preload/preload.md b/packages/docs/docs/preload/preload.md
index 31c10843c5..314af6f278 100644
--- a/packages/docs/docs/preload/preload.md
+++ b/packages/docs/docs/preload/preload.md
@@ -6,12 +6,11 @@ title: "@remotion/preload"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
+import {TableOfContents} from '../../components/TableOfContents/preload';
This package provides functions for preloading assets. While preload is not necessary for rendering, it can help with seamless playback in the [`<Player />`](/docs/player) and in the preview. Currently, three functions are implemented:
-- [`preloadVideo()`](/docs/preload/preload-video)
-- [`preloadAudio()`](/docs/preload/preload-audio)
-- [`resolveRedirect()`](/docs/preload/resolve-redirect)
+<TableOfContents />
## Installation
diff --git a/packages/docs/docs/renderer.md b/packages/docs/docs/renderer.md
index 22096f49f5..8a92b83325 100644
--- a/packages/docs/docs/renderer.md
+++ b/packages/docs/docs/renderer.md
@@ -6,6 +6,7 @@ title: "@remotion/renderer"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
+import {TableOfContents} from '../components/TableOfContents/renderer';
The `@remotion/renderer` package provides APIs for rendering video server-side.
The package is also internally used by the Remotion CLI and [Remotion Lambda](/docs/lambda).
@@ -63,13 +64,7 @@ See the [Server-side rendering](/docs/ssr) for some examples of how to use serve
The following APIs are available in the `@remotion/renderer` package:
-- [`getCompositions()`](/docs/renderer/get-compositions) - Get a list of available compositions from a Remotion project.
-- [`renderMedia()`](/docs/renderer/render-media) - Render a video or audio
-- [`renderFrames()`](/docs/renderer/render-frames) - Render an image sequence
-- [`renderStill()`](/docs/renderer/render-still) - Render a still image
-- [`stitchFramesToVideo()`](/docs/renderer/stitch-frames-to-video) - Encode a video based on an image sequence
-- [`openBrowser()`](/docs/renderer/open-browser) - Share a browser instance across function calls for even better performance.
-- [`makeCancelSignal()`](/docs/renderer/make-cancel-signal) - Returns a token that allows a render to be cancelled.
+<TableOfContents />
## What's the difference between `renderMedia()` and `renderFrames()`?
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 32446d41f1..e39ffcdeaa 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -94,6 +94,24 @@ module.exports = {
"renderer/make-cancel-signal",
],
},
+ {
+ type: "category",
+ link: {
+ type: "doc",
+ id: "player/player",
+ },
+ label: "@remotion/player",
+ items: [
+ "player/installation",
+ "player/examples",
+ "player/api",
+ "player/scaling",
+ "player/integration",
+ "player/autoplay",
+ "player/preloading",
+ "player/best-practices",
+ ],
+ },
{
type: "category",
label: "@remotion/lambda",
@@ -187,24 +205,6 @@ module.exports = {
"visualize-audio",
],
},
- {
- type: "category",
- link: {
- type: "doc",
- id: "player/player",
- },
- label: "@remotion/player",
- items: [
- "player/installation",
- "player/examples",
- "player/api",
- "player/scaling",
- "player/integration",
- "player/autoplay",
- "player/preloading",
- "player/best-practices",
- ],
- },
{
type: "category",
label: "@remotion/three",