开源工具
developers.cloudflare.com ·
@Cloudflare Developers
Cloudflare Stream 的 WebRTC 超低延迟直播正式 GA
Cloudflare 宣布 Stream 的 WebRTC 支持正式可用,可在毫秒级向大量并发观众分发高质量直播视频,并兼容原生 Web API 与标准协议,创作者可直接从浏览器开播而无需额外推流应用。该能力在 beta 期间基于 Cloudflare Realtime 原语重建,采用最新 WHIP/WHEP 标准(Trickle ICE、server/client offer 模式与 counter-offer),并纳入 Stream 分析与计费图表。自 2026 年 10 月 15 日起按视频分发分钟数计费。开发者可通过 cf CLI、API 或 Dashboard 创建 live input,响应中返回 WHIP(推流)与 WHEP(播放)URL。
AI推荐理由 Cloudflare 官方 changelog 宣布 Stream 的 WebRTC 低延迟直播正式 GA,属于可验证的产品发布信息。具体新信息包括:基于 Cloudflare Realtime 原语重建、采用 WHIP/WHEP 标准(Trickle ICE、server/client offer 模式、counter-offer)、WebRTC 用量纳入 Stream 分析与计费,并给出 cf CLI 与 API 创建 live input 的示例。局限在于这是直播基础设施能力,与 AI/模型/Agent 的直接关联较弱,主要价值在实时音视频应用与开发者工具层面。
72
正文
[Stream WebRTC support ↗︎](https://developers.cloudflare.com/stream/webrtc-beta/) lets you deliver high quality live video to thousands of concurrent viewers in milliseconds. WebRTC is compatible with native Web APIs and standard protocols, so creators can [go live from a browser ↗︎](https://developers.cloudflare.com/stream/examples/browser-based-webrtc/) without needing a separate broadcast application. This powers platforms to build custom experiences with deep feature integration for creators as well as viewers. Here's how to get started with a Stream live input and a browser.
Usage-based billing for WebRTC begins today, October 15, 2026 and follows the standard rates for minutes of video delivered. Refer to [pricing ↗︎](https://developers.cloudflare.com/stream/pricing/) for rates.
#### What changed
While in beta, Stream’s WebRTC support was rebuilt from the ground up to leverage [Cloudflare Realtime ↗︎](https://developers.cloudflare.com/realtime/)’s primitives for stability and scale while managing these components in Stream’s familiar, unified API that makes it easy to build. We also adopted the latest WHIP and WHEP protocol standards for Trickle ICE, server and client offer modes, and counter-offer support for improved player library compatibility and network traversal adaptability. Finally, WebRTC delivery will now be visible in Stream’s [analytics ↗︎](https://developers.cloudflare.com/stream/getting-analytics/) and billable usage charts.
#### How does this relate to Cloudflare Realtime
Realtime exposes a set of tools and primitives to build applications that connect people, AI systems, and devices together in many-to-many experiences powered by WebRTC. Stream leverages these building-blocks to deliver one-to-many broadcast capabilities, controlled and managed by a single, unified API with features like the [built-in player ↗︎](https://developers.cloudflare.com/stream/viewing-videos/using-the-stream-player/) and [analytics ↗︎](https://developers.cloudflare.com/stream/getting-analytics/) that make it easy to get started.
#### How do I get started
First, [create a live input ↗︎](https://developers.cloudflare.com/stream/examples/browser-based-webrtc/#1-create-a-live-input) using [cf ↗︎](https://developers.cloudflare.com/cf/), the API, or in the [Stream Dashboard ↗︎](https://dash.cloudflare.com/?to=/:account/stream/inputs):
Creating a live input with cf or APIsh
```
# Using cf, the new Cloudflare CLI
cf stream live-inputs create
# Using an API request,
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/stream/live_inputs \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-X POST
```
The response will include `webRTC` and `webRTCPlayback` properties, each containing a `url` for WHIP (broadcast) and WHEP (playback) respectively.
Next, you can go live using WHIP directly from a browser or supported broadcast software. Refer to our [new tutorial ↗︎](https://developers.cloudflare.com/stream/examples/browser-based-webrtc/) that shows a dependency-free way to broadcast live video with browser-native JavaScript.
Finally, you can play using WHEP using Stream’s [built-in player ↗︎](https://developers.cloudflare.com/stream/viewing-videos/using-the-stream-player/), a supported player app/library, or simple JavaScript:
Abbreviated JavaScript playback examplejs
```
const pc = new RTCPeerConnection();
// 1. Ask to receive one audio track and one video track.
pc.addTransceiver("video", { direction: "recvonly" });
pc.addTransceiver("audio", { direction: "recvonly" });
// 2. Attach incoming media to the video element as it arrives.
const stream = new MediaStream();
document.getElementById("playback-video").srcObject = stream;
pc.ontrack = (event) => stream.addTrack(event.track);
// 3. Create the SDP offer and set it as the local description.
const offer = await pc.createOffer();
await pc.setLocalDescription(offer);
// 4. POST the offer to the WHEP endpoint.
const response = await fetch(WHEP_URL, {
method: "POST",
headers: { "Content-Type": "application/sdp" },
body: offer.sdp,
});
// 5. Apply the SDP answer returned by Cloudflare.
const answer = await response.text();
await pc.setRemoteDescription({ type: "answer", sdp: answer });
```
Learn more in the [Stream WebRTC ↗︎](https://developers.cloudflare.com/stream/webrtc-beta/) docs or [try the all-in-one tutorial ↗︎](https://developers.cloudflare.com/stream/examples/browser-based-webrtc/) for yourself.