Skip to content

🎥 Make videos programmatically with React

code

Jonny Burger2f4f4b2bb4ee
diff --git a/packages/docs/components/LandingPage/GithubButton.tsx b/packages/docs/components/LandingPage/GithubButton.tsx
index 6093e4db6f..a561d5d462 100644
--- a/packages/docs/components/LandingPage/GithubButton.tsx
+++ b/packages/docs/components/LandingPage/GithubButton.tsx
@@ -21,10 +21,10 @@ export const GithubButton: React.FC = () => {
useEffect(() => {
fetch(`https://api.github.com/repos/remotion-dev/remotion`)
- .then(res => res.json())
- .then(json => json.watchers)
- .then(setStars)
- .catch(err => {
+ .then((res) => res.json())
+ .then((json) => json.watchers)
+ .then((w) => setStars(w))
+ .catch((err) => {
console.log(err);
setStars(null);
});
@@ -32,10 +32,9 @@ export const GithubButton: React.FC = () => {
return (
<div className={styles.container}>
- <GithubIcon /> <span>GitHub</span>{' '}
+ <GithubIcon /> <span>GitHub</span>{" "}
<div className={styles.stars}>
- <div style={{ width: 8, display: "inline-block" }}></div>{" "}
- {stars ? stars : null}
+ {stars ? Math.floor(stars / 1000) + "k" : null}
</div>
</div>
);
diff --git a/packages/docs/components/LandingPage/PlayerPreview.tsx b/packages/docs/components/LandingPage/PlayerPreview.tsx
index 6bc52a31a9..24269751b7 100644
--- a/packages/docs/components/LandingPage/PlayerPreview.tsx
+++ b/packages/docs/components/LandingPage/PlayerPreview.tsx
@@ -1,10 +1,14 @@
import React from "react";
import styles from "./playerpreview.module.css";
+const rotate: React.CSSProperties = {
+ transform: `rotate(90deg)`,
+};
+const ICON_SIZE = 18;
export const PlayerPreview: React.FC = () => {
return (
<a
- href="https://www.youtube.com/watch?v=gwlDorikqgY"
+ href="https://www.youtube.com/watch?v=deg8bOoziaE"
target="_blank"
data-splitbee-event="External Link"
data-splitbee-event-target={"YouTube Trailer"}
@@ -13,20 +17,44 @@ export const PlayerPreview: React.FC = () => {
<img
style={{
boxShadow: "var(--box-shadow)",
+ borderRadius: 12,
}}
- src="https://i3.ytimg.com/vi/gwlDorikqgY/maxresdefault.jpg"
- ></img>
+ src="/img/thumb.jpeg"
+ />
<div
style={{
width: "100%",
textAlign: "center",
- position: "absolute",
- bottom: 20,
color: "black",
fontSize: 13,
+ display: "flex",
+ flexDirection: "row",
+ justifyContent: "center",
+ alignItems: "center",
}}
>
- Watch 2 min video
+ <svg
+ width={ICON_SIZE}
+ height={ICON_SIZE}
+ viewBox="-100 -100 400 400"
+ style={rotate}
+ >
+ <path
+ fill={"var(--ifm-color-primary)"}
+ stroke={"var(--ifm-color-primary)"}
+ strokeWidth="100"
+ strokeLinejoin="round"
+ d="M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z"
+ />
+ </svg>
+ <div
+ style={{
+ marginLeft: 5,
+ color: "var(--ifm-color-primary)",
+ }}
+ >
+ Watch Intro and Tutorial (8:41)
+ </div>
</div>
</div>
</a>
diff --git a/packages/docs/components/LandingPage/github.module.css b/packages/docs/components/LandingPage/github.module.css
index a68871f233..a894fe1575 100644
--- a/packages/docs/components/LandingPage/github.module.css
+++ b/packages/docs/components/LandingPage/github.module.css
@@ -8,7 +8,12 @@
.stars {
font-size: 0.75em;
- margin-top: 2.5px;
+ display: inline-block;
+ background: var(--hover-color);
+ margin-left: 8px;
+ line-height: 1;
+ border-radius: 5px;
+ padding: 7px;
}
@media screen and (max-width: 900px) {
diff --git a/packages/docs/components/LandingPage/playerpreview.module.css b/packages/docs/components/LandingPage/playerpreview.module.css
index e99bd1a3de..2289ad7540 100644
--- a/packages/docs/components/LandingPage/playerpreview.module.css
+++ b/packages/docs/components/LandingPage/playerpreview.module.css
@@ -1,9 +1,11 @@
.playerpreview {
- display: flex;
flex: 1;
cursor: pointer;
position: relative;
transition: transform 0.3s;
+ background-color: var(--blue-underlay);
+ border-radius: 15px;
+ padding: 10px;
}
.playerpreview:hover {
diff --git a/packages/docs/docs/data-fetching.md b/packages/docs/docs/data-fetching.md
index c98783d65b..7124700453 100644
--- a/packages/docs/docs/data-fetching.md
+++ b/packages/docs/docs/data-fetching.md
@@ -10,7 +10,7 @@ One of the most groundbreaking things about Remotion is that you can fetch data
There are two functions, [`delayRender`](/docs/delay-render) and [`continueRender`](/docs/continue-render), which you can use to tell Remotion to not yet render the frame. If you want to asynchronously render a frame, you should call `delayRender()` as soon as possible, before the window `onload` event is fired. The function returns a handle that you need to give Remotion the green light to render later using `continueRender()`.
```tsx twoslash
-import { useEffect, useState } from "react";
+import { useEffect, useCallback, useState } from "react";
import { continueRender, delayRender } from "remotion";
export const MyVideo = () => {
diff --git a/packages/docs/docs/timeline.md b/packages/docs/docs/timeline.md
index 85bae19bd9..e7cf8d452d 100644
--- a/packages/docs/docs/timeline.md
+++ b/packages/docs/docs/timeline.md
@@ -9,13 +9,15 @@ You can start the preview server of Remotion using
npm start
```
-If you are using a custom template, use
+This is a shorthand for
```bash
npx remotion preview src/index.tsx
```
-where `src/index.tsx` is the file where `registerRoot()` is called.
+where `src/index.tsx` is the file where [`registerRoot()`](/docs/registerroot) is called.
+
+A server will be started on port 3000 (or 3001 if it's not available, and so on) and the preview should open in the browser.
<img src="/img/timeline.png"></img>
diff --git a/packages/docs/static/img/thumb.jpeg b/packages/docs/static/img/thumb.jpeg
new file mode 100644
index 0000000000..cfc0652c6d
Binary files /dev/null and b/packages/docs/static/img/thumb.jpeg differ