Skip to content

Commit f5844e8

Browse files
feat(lambda): allow to render the composition on aws lambda
1 parent debf940 commit f5844e8

11 files changed

Lines changed: 8807 additions & 9956 deletions

File tree

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
REMOTION_AWS_ACCESS_KEY_ID = ""
2+
REMOTION_AWS_SECRET_ACCESS_KEY = ""
3+
4+
REMOTION_SERVE_URL=""
5+
REMOTION_FUNCTION_NAME=""
6+
REMOTION_BUCKET=""
7+
REMOTION_REGION = ""

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules
44
/build
55
/public/build
66
.env
7+
/out

app/remotion/load-fonts.ts

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
11
import { continueRender, delayRender, staticFile } from "remotion";
22

3-
const waitForGroteskFont = delayRender("groteskFont");
4-
const groteskFont = new FontFace(
5-
`Founders Grotesk`,
6-
`url(${staticFile("fonts/FoundersGrotesk-Bold.woff2")}) format('woff2')`,
7-
{ weight: "700" }
8-
);
3+
export const loadFonts = async () => {
4+
const waitForGroteskFont = delayRender("groteskFont");
5+
const groteskFont = new FontFace(
6+
`Founders Grotesk`,
7+
`url(${staticFile("fonts/FoundersGrotesk-Bold.woff2")}) format('woff2')`,
8+
{ weight: "700" }
9+
);
910

10-
groteskFont
11-
.load()
12-
.then(() => {
13-
document.fonts.add(groteskFont);
14-
continueRender(waitForGroteskFont);
11+
groteskFont
12+
.load()
13+
.then(() => {
14+
document.fonts.add(groteskFont);
15+
continueRender(waitForGroteskFont);
16+
})
17+
.catch((err) => console.log("Error loading font", err));
1518

16-
console.log("Loaded Grotesk font");
17-
})
18-
.catch((err) => console.log("Error loading font", err));
19+
const waitForGtPlanar = delayRender("gtPlanar");
20+
const gtPlanarFont = new FontFace(
21+
`GTPlanar`,
22+
`url(${staticFile("fonts/gt-planar-black.woff2")}) format('woff2')`,
23+
{ weight: "700" }
24+
);
1925

20-
const waitForGtPlanar = delayRender("gtPlanar");
21-
const gtPlanarFont = new FontFace(
22-
`GTPlanar`,
23-
`url(${staticFile("fonts/gt-planar-black.woff2")}) format('woff2')`,
24-
{ weight: "700" }
25-
);
26-
27-
gtPlanarFont
28-
.load()
29-
.then(() => {
30-
document.fonts.add(gtPlanarFont);
31-
continueRender(waitForGtPlanar);
32-
console.log("Loaded GTPlanar font");
33-
})
34-
.catch((err) => console.log("Error loading font", err));
26+
gtPlanarFont
27+
.load()
28+
.then(() => {
29+
document.fonts.add(gtPlanarFont);
30+
continueRender(waitForGtPlanar);
31+
})
32+
.catch((err) => console.log("Error loading font", err));
33+
};

app/remotion/logo-animation.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { RemotionLineToPerson } from "./components/remotion-logo/remotion-line-t
99
import { RemotionNotAnimated } from "./components/remotion-logo/remotion-not-animated";
1010
import { RemotionPersonToFusion } from "./components/remotion-logo/remotion-person-to-fusion";
1111
import { LogoAnimationSequence } from "./components/logo-apparition-sequence";
12+
import { loadFonts } from "./load-fonts";
13+
loadFonts();
1214

1315
export const LogoAnimation = () => {
1416
const { fps } = useVideoConfig();

app/remotion/videos.tsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
import {Composition} from 'remotion';
2-
import './load-fonts';
3-
import {LogoAnimation} from './logo-animation';
1+
import { Composition } from "remotion";
2+
import { LogoAnimation } from "./logo-animation";
43

54
const FPS = 30;
65

76
export const RemotionVideo = () => {
8-
return (
9-
<>
10-
<Composition
11-
id="LogoAnimation"
12-
component={LogoAnimation}
13-
durationInFrames={FPS * 7}
14-
fps={FPS}
15-
width={1920}
16-
height={1080}
17-
/>
18-
</>
19-
);
7+
return (
8+
<>
9+
<Composition
10+
id="LogoAnimation"
11+
component={LogoAnimation}
12+
durationInFrames={FPS * 7}
13+
fps={FPS}
14+
width={1920}
15+
height={1080}
16+
/>
17+
</>
18+
);
2019
};

app/routes/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { LinksFunction } from "@remix-run/node";
22
import { Player } from "@remotion/player";
33
import { LogoAnimation } from "~/remotion/logo-animation";
4-
import stylesHref from "./index.css";
4+
import stylesHref from "../styles/index.css";
55

66
const FPS = 30;
77

0 commit comments

Comments
 (0)