Back to Remotion

getRenderProgress()

packages/docs/docs/vercel/get-render-progress.mdx

4.0.4961.9 KB
Original Source

getRenderProgress()<AvailableFrom v="4.0.469" />

:::warning Experimental package: We reserve the right to make breaking changes in order to correct bad design decisions until this notice is gone. :::

Polls the progress of a detached renderMediaOnVercel() call.

Use this API when your Vercel function should start a render and return before the video has finished rendering.

Example

ts
import {getRenderProgress} from '@remotion/vercel';

export async function GET(req: Request) {
  const url = new URL(req.url);
  const sandboxId = url.searchParams.get('sandboxId');
  const cmdId = url.searchParams.get('cmdId');

  if (!sandboxId || !cmdId) {
    return Response.json({error: 'Missing params'}, {status: 400});
  }

  const progress = await getRenderProgress({sandboxId, cmdId});
  return Response.json(progress);
}

Arguments

An object with the following properties:

sandboxId

The ID returned from renderMediaOnVercel({detached: true}).

cmdId

The command ID returned from renderMediaOnVercel({detached: true}).

Return value

A <TsType type="RenderProgress" source="@remotion/vercel" href="/docs/vercel/types#renderprogress" /> object.

Terminal stages are:

  • done: The render was uploaded to Vercel Blob.
  • error: The render failed.
  • expired: The sandbox no longer exists.

When done or error is returned, remove the stored render handle in your app. The sandbox is left alive until its configured timeout so a refreshed page can still read the terminal progress.

See also