WebRTC
BetaSub-second latency live streaming (using WHIP) and playback (using WHEP) to unlimited concurrent viewers.
WebRTC is ideal for when you need live video to playback in near real-time, such as:
- When the outcome of a live event is time-sensitive (live sports, financial news)
- When viewers interact with the live stream (live Q&A, auctions, etc.)
- When you want your end users to be able to easily go live or create their own video content, from a web browser or native app
Use the Stream Dashboard ↗, or make a POST request to the /live_inputs
API endpoint
Every live input has a unique URL that one creator can be stream to. This URL should only be shared with the creator — anyone with this URL has the ability to stream live video to this live input.
Copy the URL from the webRTC
key in the API response (see above), or directly from the Cloudflare Dashboard ↗.
Paste this URL into the provided WHIP example code ↗.
Once the creator grants permission to their camera and microphone, live video and audio will automatically start being streamed to Cloudflare, using WebRTC.
You can also use this URL with any client that supports the WebRTC-HTTP ingestion protocol (WHIP) ↗. See supported WHIP clients for a list of clients we have tested and confirmed compatibility with Cloudflare Stream.
Copy the URL from the webRTCPlayback
key in the API response (see above), or directly from the Cloudflare Dashboard ↗. There are no limits on the number of concurrent viewers.
Paste this URL into the provided WHEP example code ↗.
As long as the creator is actively streaming, viewers should see their broadcast in their browser, with less than 1 second of latency.
You can also use this URL with any client that supports the WebRTC-HTTP egress protocol (WHEP) ↗. See supported WHEP clients for a list of clients we have tested and confirmed compatibility with Cloudflare Stream.
If you are building a native app, the example code above can run within a WkWebView (iOS) ↗, WebView (Android) ↗ or using react-native-webrtc ↗. If you need to use WebRTC without a webview, you can use Google’s Java and Objective-C native implementations of WebRTC APIs ↗.
- Chrome: Navigate to
chrome://webrtc-internals
to view detailed logs and graphs. - Firefox: Navigate to
about:webrtc
to view information about WebRTC sessions, similar to Chrome. - Safari: To enable WebRTC logs, from the inspector, open the settings tab (cogwheel icon), and set WebRTC logging to “Verbose” in the dropdown menu.
Beyond the example WHIP client ↗ and example WHEP client ↗ used in the examples above, we have tested and confirmed that the following clients are compatible with Cloudflare Stream:
- OBS (Open Broadcaster Software) ↗
- @eyevinn/whip-web-client ↗ (TypeScript)
- whip-go ↗ (Go)
- gst-plugins-rs ↗ (Gstreamer plugins, written in Rust)
- Larix Broadcaster ↗ (free apps for iOS and Android with WebRTC based on Pion, SDK available)
- @eyevinn/webrtc-player ↗ (TypeScript)
- @eyevinn/wrtc-egress ↗ (TypeScript)
- gst-plugins-rs ↗ (Gstreamer plugins, written in Rust)
As more WHIP and WHEP clients are published, we are committed to supporting them and being fully compliant with the both protocols.
- VP9 ↗ (recommended for highest quality)
- VP8 ↗
- h264 ↗ (Constrained Baseline Profile Level 3.1, referred to as
42e01f
in the SDP offer’sprofile-level-id
parameter.)
Cloudflare Stream fully supports all aspects of the WHIP ↗ and WHEP ↗ specifications, including:
You can find the specific version of WHIP and WHEP being used in the protocol-version
header in WHIP and WHEP API responses. The value of this header references the IETF draft slug for each protocol. Currently, Stream uses draft-ietf-wish-whip-06
(expected to be the final WHIP draft revision) and draft-murillo-whep-01
(the most current WHEP draft).
- Recording is not yet supported (coming soon)
- Simulcasting (restreaming) is not yet supported (coming soon)
- Live viewer counts are not yet supported (coming soon)
- Analytics are not yet supported (coming soon)
- WHIP and WHEP must be used together — we do not yet support streaming using RTMP/SRT and playing using WHEP, or streaming using WHIP and playing using HLS or DASH. (coming soon)
- Once generally available, WebRTC streaming will be priced just like the rest of Cloudflare Stream, based on minutes stored and minutes of video delivered.