Cloudflare 中文文档
Stream
编辑这个页面
跳转官方原文档
Set theme to dark (⇧+D)

Get started with Cloudflare Stream

​​ Upload your first video

​​ Step 1: Upload an example video from a public URL

You can upload videos directly from the Cloudflare dashboard or using the API.

To use the API, replace the API_TOKEN and ACCOUNT_ID values with your credentials in the example below.

​​ Step 2: Wait until the video is ready to stream

Because Stream must download and process the video, the video might not be available for a few seconds depending on the length of your video. You should poll the Stream API until readyToStream is true, or use webhooks to be notified when a video is ready for streaming.

Use the video UID from the first step to poll the video:

​​ Step 3: Play the video in your website or app

Videos uploaded to Stream can be played on any device and platform, from websites to native apps. See Play videos for details and examples of video playback across platforms.

To play video on your website with the Stream Player, copy the uid of the video from the request above, along with your unique customer code, and replace <CODE> and <VIDEO_UID> in the embed code below:

The embed code above can also be found in the Cloudflare dashboard.

​​ Next steps

​​ Start your first live stream

​​ Step 1: Create a live input

You can create a live input via the Cloudflare dashboard or using the API.

To use the API, replace the API_TOKEN and ACCOUNT_ID values with your credentials in the example below.

​​ Step 2: Copy the RTMPS URL and key, and use them with your live streaming application.

We recommend using Open Broadcaster Software (OBS) to get started.

​​ Step 3: Play the live stream in your website or app

Live streams can be played on any device and platform, from websites to native apps, using the same video players as videos uploaded to Stream. See Play videos for details and examples of video playback across platforms.

To play the live stream you just started on your website with the Stream Player, copy the uid of the live input from the request above, along with your unique customer code, and replace <CODE> and <VIDEO_UID> in the embed code below:

The embed code above can also be found in the Cloudflare dashboard.

​​ Next steps

​​ Accessibility considerations

To make your video content more accessible, include captions and high-quality audio recording.