Skip to main content

getCompositions()

Part of the @remotion/renderer package.

Gets the compositions defined in a Remotion project based on a webpack bundle. Spins up a browser with Puppeteer and evaluates the Remotion root.

ts
const getCompositions: (
bundle: string,
options: {
inputProps?: object | null
browserInstance?: puppeteer.Browser
}
) => Promise<TComposition[]>
ts
const getCompositions: (
bundle: string,
options: {
inputProps?: object | null
browserInstance?: puppeteer.Browser
}
) => Promise<TComposition[]>

Arguments#

bundle#

A string pointing to a Webpack bundle generated by @remotion/bundler.

options?#

optional

An object containing one or more of the following options:

inputProps?#

optional

Define custom props that can be retrieved using getInputProps() at runtime. Useful for setting a dynamic duration or dimensions for your video.

browserInstance?#

optional

An already open Puppeteer Browser instance. Reusing a browser across multiple function calls can speed up the rendering process. You are responsible for opening and closing the browser yourself. If you don't specify this option, a new browser will be opened and closed at the end.

Return value#

Returns a promise that resolves to an array of available compositions. Example value:

ts
[
{
id: 'HelloWorld',
width: 1920,
height: 1080,
fps: 30,
},
{
id: 'Title',
width: 1080,
height: 1080,
fps: 30,
},
]
ts
[
{
id: 'HelloWorld',
width: 1920,
height: 1080,
fps: 30,
},
{
id: 'Title',
width: 1080,
height: 1080,
fps: 30,
},
]

See also#