🎥 Make videos programmatically with React
rename src/Video.tsx to src/Root.tsx
Jonny Burger723f3421d41d
diff --git a/packages/cli/src/preview-server/project-info.ts b/packages/cli/src/preview-server/project-info.tsindex d4e5591fd7..8a435b4e01 100644--- a/packages/cli/src/preview-server/project-info.ts+++ b/packages/cli/src/preview-server/project-info.ts@@ -7,7 +7,12 @@ export type ProjectInfo = {};export const getProjectInfo = (remotionRoot: string): Promise<ProjectInfo> => {- const pathsToLookFor = ['src/Video.tsx', 'src/Video.jsx'].map((p) => {+ const pathsToLookFor = [+ 'src/Root.tsx',+ 'src/Root.jsx',+ 'src/Video.tsx',+ 'src/Video.jsx',+ ].map((p) => {return path.join(remotionRoot, p);});diff --git a/packages/docs/docs/composition.md b/packages/docs/docs/composition.mdindex 2874159101..b1e9960d52 100644--- a/packages/docs/docs/composition.md+++ b/packages/docs/docs/composition.md@@ -7,7 +7,7 @@ This is the component to use to register a video to make it renderable and makeA composition represents the video you want to create, as a collection of clips (for example, several `<Sequence>`) that will play back to back to form your video.-```tsx twoslash title="src/Video.tsx"+```tsx twoslash title="src/Root.tsx"const Component: React.FC = () => null;// ---cut---diff --git a/packages/docs/docs/register-root.md b/packages/docs/docs/register-root.mdindex fc50318b2a..b6a6c92473 100644--- a/packages/docs/docs/register-root.md+++ b/packages/docs/docs/register-root.md@@ -12,18 +12,18 @@ title: registerRoot()## Example```tsx twoslash title="src/index.ts"-// @filename: ./Video.tsx-export const RemotionVideo = () => <></>;+// @filename: ./Root.tsx+export const RemotionRoot = () => <></>;// @filename: index.tsx// ---cut---import { registerRoot } from "remotion";-import { RemotionVideo } from "./Video";+import { RemotionRoot } from "./Root";-registerRoot(RemotionVideo);+registerRoot(RemotionRoot);```-```tsx twoslash title="src/Video.tsx"+```tsx twoslash title="src/Root.tsx"// @allowUmdGlobalAccess// @filename: MyComponent.tsxexport default () => <></>;@@ -77,7 +77,7 @@ export const RemotionVideo = () => <></>;const loadWebAssembly = () => Promise.resolve();// ---cut----import { delayRender, continueRender, registerRoot } from "remotion";+import { continueRender, delayRender, registerRoot } from "remotion";import { RemotionVideo } from "./Video";const wait = delayRender();diff --git a/packages/docs/docs/spline.md b/packages/docs/docs/spline.mdindex 70b2fc6503..ec93805e4e 100644--- a/packages/docs/docs/spline.md+++ b/packages/docs/docs/spline.md@@ -83,12 +83,12 @@ Your 3D model should look like this:5. In `src/Scene.tsx`, replace the default scene with:-```tsx twoslash title="src/Video.tsx"+```tsx twoslash title="src/Root.tsx"// @filename: src/Torus.tsximport React from "react";const Torus: React.FC = () => null;export default Torus;-// @filename: src/Video.tsx+// @filename: src/Root.tsx// ---cut---// @jsx: react-jsximport { ThreeCanvas } from "@remotion/three";diff --git a/packages/docs/docs/tailwind-2.md b/packages/docs/docs/tailwind-2.mdindex bd9a37092e..d8eb222e87 100644--- a/packages/docs/docs/tailwind-2.md+++ b/packages/docs/docs/tailwind-2.md@@ -99,7 +99,7 @@ Config.Bundling.overrideWebpackConfig((currentConfiguration) => {@tailwind utilities;```-4. Import the stylesheet in your `src/Video.tsx` file. Add to the top of the file:+4. Import the stylesheet in your `src/Root.tsx` file. Add to the top of the file:```jsimport "./style.css";diff --git a/packages/docs/docs/tailwind.md b/packages/docs/docs/tailwind.mdindex 9d91f5c6d1..f30227271f 100644--- a/packages/docs/docs/tailwind.md+++ b/packages/docs/docs/tailwind.md@@ -150,9 +150,9 @@ Config.Bundling.overrideWebpackConfig(enableTailwind);@tailwind utilities;```-6. Import the stylesheet in your `src/Video.tsx` file. Add to the top of the file:+6. Import the stylesheet in your `src/Root.tsx` file. Add to the top of the file:-```js title="src/Video.tsx"+```js title="src/Root.tsx"import "./style.css";```diff --git a/packages/docs/docs/the-fundamentals.md b/packages/docs/docs/the-fundamentals.mdindex 90bf0aa2be..bcc87cbbe6 100644--- a/packages/docs/docs/the-fundamentals.md+++ b/packages/docs/docs/the-fundamentals.md@@ -72,9 +72,9 @@ A video's first frame is `0` and it's last frame is `durationInFrames - 1`.Using a [composition](/docs/terminology#composition) you can define a video that should be rendered.-You define a composition by rendering a [`<Composition>`](/docs/composition) component in `src/Video.tsx`, giving it an `id`, defining values for its `height`, `width`, `fps` and `durationInFrames`, and passing a React component to `component`.+You define a composition by rendering a [`<Composition>`](/docs/composition) component in `src/Root.tsx`, giving it an `id`, defining values for its `height`, `width`, `fps` and `durationInFrames`, and passing a React component to `component`.-```tsx twoslash title="src/Video.tsx"+```tsx twoslash title="src/Root.tsx"import { Composition } from "remotion";// @include: example-MyComposition// ---cut---@@ -95,4 +95,4 @@ export const RemotionVideo: React.FC = () => {};```-You can render as many compositions as you like in `src/Video.tsx`.+You can render as many compositions as you like in `src/Root.tsx`.diff --git a/packages/docs/docs/troubleshooting/defaultprops-too-big.md b/packages/docs/docs/troubleshooting/defaultprops-too-big.mdindex d66f21d8e2..a231e696eb 100644--- a/packages/docs/docs/troubleshooting/defaultprops-too-big.md+++ b/packages/docs/docs/troubleshooting/defaultprops-too-big.md@@ -45,7 +45,7 @@ const MyComp: React.FC<{return null;};-// src/Video.tsx+// src/Root.tsxconst RemotionRoot = () => {const [audioData, setAudioData] = useState<AudioData | null>(null);const [handle] = useState(() => delayRender());@@ -103,7 +103,7 @@ const MyComp: React.FC<{ src: string }> = ({ src }) => {return null;};-// src/Video.tsx+// src/Root.tsxconst RemotionRoot = () => {return (<Compositiondiff --git a/packages/docs/docs/troubleshooting/loading-root-component.md b/packages/docs/docs/troubleshooting/loading-root-component.mdindex 4698303c72..762e326b8b 100644--- a/packages/docs/docs/troubleshooting/loading-root-component.md+++ b/packages/docs/docs/troubleshooting/loading-root-component.md@@ -13,7 +13,7 @@ You have specified an [entry point](/docs/terminology#entry-point) that does notIn most of the templates, the entry point is `src/index.ts`.-- Maybe you have specified the list of compositions (`src/Video.tsx` in most templates) instead.+- Maybe you have specified the list of compositions (`src/Root.tsx` in most templates) instead.- Maybe you have specified the filename of a component that you want to render.Ensure that you are passing the file that calls [`registerRoot()`](/docs/register-root) as the entry point.