Skip to content

🎥 Make videos programmatically with React

Docs: Better docs for the <Player>

Jonny Burger42b6678ee559
diff --git a/packages/docs/components/PlayerExampleWithControls.tsx b/packages/docs/components/PlayerExampleWithControls.tsx
index 6ecd542cb7..265ef25a0b 100644
--- a/packages/docs/components/PlayerExampleWithControls.tsx
+++ b/packages/docs/components/PlayerExampleWithControls.tsx
@@ -1,11 +1,11 @@
-import { useState } from "react";
-import React from "react";
+import React, { useState } from "react";
import { PlayerExample } from "./PlayerExample";
import { CoolInput } from "./TextInput";
export const PlayerExampleWithControls: React.FC = () => {
const [name, setName] = useState("");
const [color, setColor] = useState("#4098f5");
+
return (
<div>
<PlayerExample name={name} color={color} />
diff --git a/packages/docs/components/TableOfContents/player.tsx b/packages/docs/components/TableOfContents/player.tsx
index 12818fd2ce..edd589c692 100644
--- a/packages/docs/components/TableOfContents/player.tsx
+++ b/packages/docs/components/TableOfContents/player.tsx
@@ -8,11 +8,11 @@ export const TableOfContents: React.FC = () => {
<Grid>
<TOCItem link="/docs/player/player">
<strong>{"<Player>"}</strong>
- <div>Embed a Remotion composition in a webapp</div>
+ <div>Embed a Remotion composition in a web app</div>
</TOCItem>
<TOCItem link="/docs/player/thumbnail">
<strong>{"<Thumbnail>"}</strong>
- <div>Embed a still in a webapp</div>
+ <div>Embed a still in a web app</div>
</TOCItem>
</Grid>
</div>
diff --git a/packages/docs/components/TextInput.tsx b/packages/docs/components/TextInput.tsx
index 7341e17ae0..4037d7dc9b 100644
--- a/packages/docs/components/TextInput.tsx
+++ b/packages/docs/components/TextInput.tsx
@@ -13,7 +13,7 @@ const inputStyle: React.CSSProperties = {
const backgroundStyle = (
focused: boolean,
- fullWidth: boolean
+ fullWidth: boolean,
): React.CSSProperties => {
return {
padding: 2,
@@ -24,7 +24,7 @@ const backgroundStyle = (
transition: "0.2s background-color",
borderRadius: 7,
overflow: "hidden",
- width: "100%",
+ width: fullWidth ? "100%" : undefined,
};
};
diff --git a/packages/docs/docs/player/player-integration.md b/packages/docs/docs/player/player-integration.md
index 251cf5c764..119c711deb 100644
--- a/packages/docs/docs/player/player-integration.md
+++ b/packages/docs/docs/player/player-integration.md
@@ -14,7 +14,17 @@ If you are using the player, a common desire is to share the code with your Remo
Remotion and your React app use a different Webpack config. Therefore, if you want to override your [Webpack configuration](/docs/webpack), you need to override both the Remotion one and the React app one.
:::
-## Setup
+## Template
+
+Use one of our starter templates:
+
+- [Next.js (App dir)](/templates/next)
+- [Next.js (Pages dir)](/templates/next-pages-dir)
+- [Remix](/templates/remix)
+
+which have the Player and Lambda already set up.
+
+## Manual setup
Set up a React project with your preferred setup from the [Official React docs](https://react.dev/learn/start-a-new-react-project). Popular choices are:
@@ -197,7 +207,7 @@ import path from "path";
import { bundle } from "@remotion/bundler";
const bundled = await bundle(
- path.join(process.cwd(), "src", "remotion", "index.ts")
+ path.join(process.cwd(), "src", "remotion", "index.ts"),
);
```
diff --git a/packages/docs/docs/troubleshooting/video-flicker.md b/packages/docs/docs/troubleshooting/video-flicker.md
index fc02dbf93d..6042ddf97c 100644
--- a/packages/docs/docs/troubleshooting/video-flicker.md
+++ b/packages/docs/docs/troubleshooting/video-flicker.md
@@ -2,6 +2,7 @@
image: /generated/articles-docs-troubleshooting-video-flicker.png
id: player-flicker
title: "Avoiding flickering in <Player>"
+sidebar_label: Avoiding flickers
crumb: "Frame-perfection"
---
@@ -32,7 +33,7 @@ This is a design tradeoff of Remotion, but can be fought with different levels o
<strong><Step>1</Step>Option 1: Ignore</strong><br/>
-It should be mentioned that this effect is only happening in the Remotion Studio and the Remotion Player, and will not appear in the rendered video. If you are only looking for a frame-perfect rendered video, you do not need to take additional steps.
+This effect is only happening in the Remotion Studio and the Remotion Player, and will not appear in the rendered video. If you are only looking for a frame-perfect rendered video, you do not need to take additional steps.
<strong><Step>2</Step>Option 2: Pause the <code>{"<Player/>"}</code> when media is buffering</strong><br/>
@@ -77,25 +78,25 @@ export const Premount: React.FC<PremountProps> = ({
const { id } = useVideoConfig();
if (typeof premountFor === "undefined") {
throw new Error(
- `The <Premount /> component requires a 'for' prop, but none was passed.`
+ `The <Premount /> component requires a 'for' prop, but none was passed.`,
);
}
if (typeof premountFor !== "number") {
throw new Error(
- `The 'for' prop of <Premount /> must be a number, but is of type ${typeof premountFor}`
+ `The 'for' prop of <Premount /> must be a number, but is of type ${typeof premountFor}`,
);
}
if (Number.isNaN(premountFor)) {
throw new Error(
- `The 'for' prop of <Premount /> must be a real number, but it is NaN.`
+ `The 'for' prop of <Premount /> must be a real number, but it is NaN.`,
);
}
if (!Number.isFinite(premountFor)) {
throw new Error(
- `The 'for' prop of <Premount /> must be a finite number, but it is ${premountFor}.`
+ `The 'for' prop of <Premount /> must be a finite number, but it is ${premountFor}.`,
);
}
@@ -152,25 +153,25 @@ export const Premount: React.FC<PremountProps> = ({
const sequenceContext = useContext(Internals.SequenceContext);
if (typeof premountFor === "undefined") {
throw new Error(
- `The <Premount /> component requires a 'for' prop, but none was passed.`
+ `The <Premount /> component requires a 'for' prop, but none was passed.`,
);
}
if (typeof premountFor !== "number") {
throw new Error(
- `The 'for' prop of <Premount /> must be a number, but is of type ${typeof premountFor}`
+ `The 'for' prop of <Premount /> must be a number, but is of type ${typeof premountFor}`,
);
}
if (Number.isNaN(premountFor)) {
throw new Error(
- `The 'for' prop of <Premount /> must be a real number, but it is NaN.`
+ `The 'for' prop of <Premount /> must be a real number, but it is NaN.`,
);
}
if (!Number.isFinite(premountFor)) {
throw new Error(
- `The 'for' prop of <Premount /> must be a finite number, but it is ${premountFor}.`
+ `The 'for' prop of <Premount /> must be a finite number, but it is ${premountFor}.`,
);
}
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 3467397e90..75a5574d99 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -547,6 +547,7 @@ module.exports = {
"player/current-time",
"player/preloading",
"player/best-practices",
+ "troubleshooting/player-flicker",
],
},
{
@@ -643,6 +644,11 @@ module.exports = {
type: "category",
label: "Building apps",
items: [
+ {
+ type: "link",
+ href: "/docs/player",
+ label: "Player",
+ },
"brownfield",
"video-uploads",
"buffer-state",
@@ -690,7 +696,6 @@ module.exports = {
"troubleshooting/loading-root-component",
"troubleshooting/defaultprops-too-big",
"troubleshooting/could-not-be-parsed-as-a-value-list",
- "troubleshooting/player-flicker",
"troubleshooting/broken-fast-refresh",
],
},