Embedding videos
VideoGen files are private by default. To share or embed them, call enable public preview on the file. That always returns a permanent public URL (staticPublicPreviewSource) for any file type — images, audio, video, PDFs, and more.
For video and audio embeds, the same call also registers a public playback ID (publicPlaybackId) once streaming is ready. Pass that ID to @videogen/player or @videogen/player-react for a branded player with adaptive streaming.
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 works for any file type — not just video and audio.
TypeScript
Python
cURL
The response includes:
Which URL should I use?
- Embedded video or audio player →
publicPlaybackIdwith@videogen/player(adaptive streaming, branded controls). - Direct permanent link (image in a blog post, PDF download, simple
<video src>fallback, etc.) →staticPublicPreviewSource.url.
For video and audio, the endpoint starts a streaming upload if one does not exist yet and polls briefly for the embed playback id. If streaming is still processing, use pollPublicPreview / poll_public_preview from the SDK (or poll GET /v1/files/{fileId}) until staticPublicPreviewSource and publicPlaybackId are ready.
To disable public preview later, call POST /v1/files/{fileId}/disable-public-preview. This removes the public URL copy and revokes embed streaming access.
3. Simple HTML embed
When you only need a basic player, drop the permanent public MP4 URL into a native HTML5 <video> tag. This works in any CMS, static site, or email-adjacent landing page that accepts HTML.
Use staticPublicPreviewSource.url (or staticPublicPreviewUrl from the export embed API) as the src. The title attribute helps accessibility and SEO. The fallback link credits VideoGen without requiring the adaptive player.
This serves a single MP4 file. It does not adapt quality to the viewer’s connection. For production embeds that need adaptive bitrate streaming, use the VideoGen Player below.
4. VideoGen Player (adaptive HLS embed)
The VideoGen Player packages decode your publicPlaybackId and render a playback-optimized embed: adaptive bitrate streaming over HLS, automatic quality switching as bandwidth changes, and branded controls tuned for exported VideoGen media.
Install the package for your stack:
React
Vanilla JS
Pass the publicPlaybackId from step 2 to the player:
React
Vanilla JS
The component accepts these props:
5. Framework integration
The same publicPlaybackId works across popular web stacks. React apps use @videogen/player-react. Every other framework below mounts @videogen/player on a DOM node.
Next.js (App Router)
Vue 3
Svelte
Angular
Static HTML (module script)
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.):