Videos SDK
Guides

Capability-safe by types

How videos-sdk turns unsupported provider operations into compile errors.

Each adapter declares its capabilities as literal types. The createVideos facade reads those types and narrows its API to match — so a provider that can't do something never lets you call it.

const mux = createVideos({ adapter: mux(cfg) });
(await mux.playback(id)).dash; // ❌ Property 'dash' does not exist — Mux has no DASH

const cf = createVideos({ adapter: cloudflare(cfg) });
(await cf.playback(id)).dash; // ✅ string — Cloudflare supports DASH

The same applies to gated methods and options:

bunny.thumbnail(id, { time: 5 }); // ❌ Bunny thumbnails have no time offset

The capability matrix

CapabilityReheliosMuxBunnyCloudflare
Resumable upload✓✓✓✓
Ingest from URL✓✓✓✓
HLS playback✓✓✓✓
DASH playback✓——✓
Signed playback✓✓✓✓
Thumbnail at time—✓—✓
Captions from file✓—✓✓
Captions from URL—✓——
Webhooks✓✓✓✓

Captions are the second place a capability changes a signature rather than removing a method. Mux ingests a subtitle track by fetching a public URL; the other three take the file itself. So captionSource narrows what captions.add accepts:

mux.captions.add(id, { language: "en", label: "English", url: vttUrl });
mux.captions.add(id, { language: "en", label: "English", body: file });
//                                                        ❌ Mux takes no file

bunny.captions.add(id, { language: "en", label: "English", body: file });

Where a provider can't do something, the SDK says so. If you reach for it through a cast anyway, it throws a VideoError with code unsupported_operation at runtime.

On this page