Embedding videos
VideoGen videos are private by default. To embed a video on your site, you first enable public preview on the file to get a public playback ID, then pass that ID to the VideoGen player package.
1. Generate a video
Use any video tool (e.g. generateVideoClip) and wait for the execution to complete:
TypeScript
Python
2. Enable public preview
Call the enable public preview endpoint on the generated file. This returns the file with a publicPlaybackId that you’ll pass to the player.
TypeScript
Python
cURL
The response includes:
To disable public preview later, call POST /v1/files/{fileId}/disable-public-preview.
3. Install the player
Choose the package for your stack:
React
Vanilla JS
4. Embed the video
Pass the publicPlaybackId from step 2 to the player:
React
Vanilla JS
The component accepts these props:
Controlling playback (React)
The React component exposes a ref with playback controls:
Using the raw HLS URL
If you prefer to use your own player, the publicHlsUrl field from the enable public preview response is a standard HLS stream URL that works with any HLS-compatible player (hls.js, Video.js, native Safari, etc.):