December 2, 2026 · Cloudflare
Stream - Clip videos, get caption files, and customize signed tokens with the Stream binding
What changed
Stream binding for Workers: Adds video clipping, custom signed URL tokens, and caption file fetching as WebVTT.
The Stream binding for Workers now supports clipping videos, customizing signed URL tokens, and fetching caption files.
Clip a video into a new video from a time range of an existing one:
const clip = await env.STREAM.clip("VIDEO_ID", {
startTimeSeconds: 10,
endTimeSeconds: 40,
});const clip = await env.STREAM.clip("VIDEO_ID", {
startTimeSeconds: 10,
endTimeSeconds: 40,
});
Customize signed URL tokens with an expiry, download access, IP and country access rules, or your own signing key, without making an API call:
const token = await env.STREAM.video("VIDEO_ID").generateToken({
expiresAt: new Date(Date.now() + 30 * 60 * 1000),
downloadable: true,
accessRules: [
{ type: "ip.geoip.country", action: "allow", country: ["US"] },
{ type: "any", action: "block" },
],
});const token = await env.STREAM.video("VIDEO_ID").generateToken({
expiresAt: new Date(Date.now() + 30 * 60 * 1000),
downloadable: true,
accessRules: [
{ type: "ip.geoip.country", action: "allow", country: ["US"] },
{ type: "any", action: "block" },
],
});
Fetch a caption file as a WebVTT stream:
const vtt = await env.STREAM.video("VIDEO_ID").captions.get("en");
const response = new Response(vtt, {
headers: { "Content-Type": "text/vtt" },
});const vtt = await env.STREAM.video("VIDEO_ID").captions.get("en");
const response = new Response(vtt, {
headers: { "Content-Type": "text/vtt" },
});
These methods also work in the binding's local simulation during local development. Refer to Local development for what the local simulation does not support.
Free. Unsubscribe any time.