Stream - Introducing Stream Bindings for Workers
Key Points
- Upload and manage videos from Workers
- Generate signed playback tokens without keys
- Supports AI-generated video pipelines
Summary
Cloudflare Stream now provides a Workers binding (env.STREAM) that lets you upload videos, provision direct uploads, manage metadata, and generate signed playback tokens directly from a Worker — without making authenticated REST API calls. This tightens integration between Stream and Workers, enabling programmatic video pipelines, AI-generated video ingestion, and inference workflows.
Key Points
- Add the Stream binding to your wrangler config (wrangler.jsonc or wrangler.toml) to expose
env.STREAMto your Worker. - Upload videos or direct upload links from a URL:
await env.STREAM.upload(videoUrl)— returns video ID, playback and manifest URLs. - Generate signed playback tokens server-side:
await env.STREAM.video(videoId).generateToken()(no signing key management required). - Read and update video properties:
await env.STREAM.video(videoId).details()and.update({ meta: { ... } }). - Integrate with AI: upload assets returned from
env.AI.run(...).result.videodirectly to Stream from a Worker. - Use cases: programmatic pipelines, tighter app integrations, generative-AI and inference workloads.
Getting started (practical)
- Add the
streambinding to wrangler.jsonc or wrangler.toml (example:[stream] binding = "STREAM"). - Call the main APIs from your Worker:
env.STREAM.upload(...),.video(id).generateToken(),.video(id).details(),.video(id).update(...). - Refer to the Cloudflare "Bind to Workers API" docs for the full API surface and examples.
Keep Worker code minimal by using the binding to avoid extra REST auth and key management.