ClaudeCloudflare Developer PlatformMay 7, 2026, 12:00 AM

Stream - Introducing Stream Bindings for Workers

A condensed section focused on the key takeaways first.

Original Post

Quick Digest

Summary

A condensed section focused on the key takeaways first.

claudeenmodel: claude-haiku-4-5

Introducing Stream Bindings for Workers

Key Points

  • Stream Bindings eliminate authenticated API calls for video operations
  • Generate signed playback tokens and manage metadata programmatically
  • Integrate AI video generation with Stream uploads in Workers

Summary

Cloudflare has introduced Stream Bindings for Workers, enabling programmatic interaction with your Stream video library directly from Workers. This eliminates the need for authenticated API calls and supports video uploads, direct uploads, metadata management, and signed URL generation.

Key Points

  • Upload videos from URLs or create direct upload links for end users without API authentication
  • Generate signed playback tokens without managing signing keys
  • Manage video metadata, captions, downloads, and watermarks programmatically
  • Build complete video pipelines within Workers
  • Integrate with AI inference workloads (e.g., generate videos with Veo-3.1 and upload directly to Stream)

Getting Started

Add the Stream binding to your wrangler.toml or wrangler.jsonc:

[stream]
binding = "STREAM"

Then use the binding in your Worker code to upload videos, generate tokens, and manage video properties via simple method calls like env.STREAM.upload(), env.STREAM.video(id).generateToken(), and env.STREAM.video(id).update().

Full Translation

Translations

A translation section that keeps the flow of the original article.

claudejamodel: claude-haiku-4-5

Stream - Workers向けStream Bindingsの紹介

Introducing Stream Bindings for Workers

2026年5月7日 | Stream

Workers向けの新しいBindingsを使用して、Stream動画ライブラリと対話できるようになりました。これにより、顧客はWorkerから認証されたAPIコールを行わずに、Streamにコンテンツをアップロードし、直接アップロードをプロビジョニングし、動画を管理し、署名付きURLを生成できます。StreamとWorkersをより密接に統合し、より多くのプログラマティックパイプライン、より緊密な統合、生成AIと推論ワークロードのサポートを実現できることに興奮しています。

Stream Bindingを使用する場合

Stream Bindingは以下の場合に使用してください:

  • URLから動画をアップロードするか、エンドユーザー向けの基本的な直接アップロードリンクを作成する
  • 署名キーを管理せずに署名付き再生トークンを生成する
  • 動画メタデータ、キャプション、ダウンロード、ウォーターマークを管理する
  • Workers内で完全に動画パイプラインを構築する

開始方法

Wrangler設定にStream Bindingを追加します:

wrangler.jsonc

{
  "$schema": "./node_modules/wrangler/config-schema.json",
  "stream": {
    "binding": "STREAM"
  }
}

wrangler.toml

[stream]
binding = "STREAM"

AIで動画を生成してStreamに直接アップロード

AIで動画を生成するか、既存のファイルのURLを送信します:

JavaScript

const aiResponse = await env.AI.run(
  "google/veo-3.1",
  {
    prompt: "A dog walking next to a river",
    duration: "10s",
    aspect_ratio: "16:9",
    resolution: "1080p",
    generate_audio: true,
  },
  {
    gateway: {
      id: "experiments",
    },
  }
);

// Veoは生成されたアセットのURLを返します
const videoUrl = aiResponse.result.video;

// 代替オプション:Austin Officeモバイルの動画
// const videoUrl = 'https://pub-d9fcbc1abcd244c1821f38b99017347f.r2.dev/aus-mobile.mp4';

// URLを提供してStreamにアップロード
const streamVideo = await env.STREAM.upload(videoUrl);

// streamVideoレスポンスには、動画ID、再生およびマニフェストURL、
// およびREST APIと同様のその他の情報が含まれます

TypeScript

const aiResponse = await env.AI.run(
  'google/veo-3.1',
  {
    prompt: 'A dog walking next to a river',
    duration: '10s',
    aspect_ratio: '16:9',
    resolution: '1080p',
    generate_audio: true,
  },
  {
    gateway: {
      id: 'experiments',
    },
  }
);

// Veoは生成されたアセットのURLを返します
const videoUrl = aiResponse.result.video;

// 代替オプション:Austin Officeモバイルの動画
// const videoUrl = 'https://pub-d9fcbc1abcd244c1821f38b99017347f.r2.dev/aus-mobile.mp4';

// URLを提供してStreamにアップロード
const streamVideo = await env.STREAM.upload(videoUrl);

// streamVideoレスポンスには、動画ID、再生およびマニフェストURL、
// およびREST APIと同様のその他の情報が含まれます

署名キーやAPIコールを使用せずに署名付きURLを生成

JavaScript

const video_id = "ce800be43a9772f4bb02f35b860fb516";
const token = await env.STREAM.video(video_id).generateToken();

// iframeエンベッドコード、マニフェストURL、またはサムネイルで「token」を使用します:
const embedUrl = `https://customer-igynxd2rwhmuoxw8.cloudflarestream.com/${token}/iframe`;

TypeScript

const video_id = 'ce800be43a9772f4bb02f35b860fb516';
const token = await env.STREAM.video(video_id).generateToken();

// iframeエンベッドコード、マニフェストURL、またはサムネイルで「token」を使用します:
const embedUrl = `https://customer-igynxd2rwhmuoxw8.cloudflarestream.com/${token}/iframe`;

動画プロパティを簡単に取得および設定

JavaScript

const video_id = "46c8b7f480d410840758c1cb14a72e47";
const result = await env.STREAM.video(video_id).details();

await env.STREAM.video(video_id).update({
  meta: {
    name: "sample video",
  },
});

TypeScript

const video_id = '46c8b7f480d410840758c1cb14a72e47';
const result = await env.STREAM.video(video_id).details();

await env.STREAM.video(video_id).update({
  meta: {
    name: 'sample video',
  },
});

詳細情報

セットアップ手順と完全なAPIリファレンスについては、Bind to Workers APIを参照してください。

Agentを使い始める

Cloudflare Stream(env.STREAM)のBindingを追加します。ウォッチページで、Stream Bindingを使用してIDに基づいて情報を取得し、video.meta.nameをページタイトルとして活用します。