Skip to content

🎥 Make videos programmatically with React

improve DX of SSR.md example

Tom Byrerc7425992ac07
diff --git a/packages/docs/docs/ssr.md b/packages/docs/docs/ssr.md
index 8a712e3eea..f9db377041 100644
--- a/packages/docs/docs/ssr.md
+++ b/packages/docs/docs/ssr.md
@@ -22,15 +22,15 @@ The NPM package `@remotion/renderer` provides you with an API for rendering the
Follow this commented example to see how to render a video:
```tsx twoslash
-import { bundle } from "@remotion/bundler";
import path from "path";
+import { bundle } from "@remotion/bundler";
import { getCompositions, renderMedia } from "@remotion/renderer";
const start = async () => {
// The composition you want to render
const compositionId = "HelloWorld";
- // Create a webpack bundle of the video.
+ console.log(`Creating webpack bundle of the video.`)
// You only have to do this once, you can reuse the bundle.
const bundleLocation = await bundle(path.resolve("./src/index"));
@@ -53,14 +53,17 @@ const start = async () => {
// Ensure the composition exists
if (!composition) {
- throw new Error(`No composition with the ID ${compositionId} found`);
+ throw new Error(`No composition with the ID ${compositionId} found.
+ Review "src/Video.jsx" for the correct ID.`);
}
+ const outputLocation = `out/${compositionId}.mp4`;
+ console.log("Attempting to render:", outputLocation)
await renderMedia({
composition,
serveUrl: bundleLocation,
codec: "h264",
- outputLocation: "out/video.mp4",
+ outputLocation: outputLocation,
inputProps,
});
};