Watch a live stream
When an input begins receiving the live stream, a new video with HLS and DASH URLs is automatically created as long as the mode property for the input is set to automatic
.
A live input can have multiple video UIDs associated with it. To get the video UID representing the current live stream for a given input, make a GET
request to the /stream
endpoint.
To play the video in your browser, use the URL from the preview
field. To use your own player, use the hls
or dash
URLs.
The response contains the HLS/DASH URL that can be used to play the current live video as well as any previously recorded live videos. In the example below, the state of the live video is live-inprogress
and the state for previously recorded video is ready
.
To get the embed code or HLS Manifest URL for your video:
- Log in to your Cloudflare dashboard ↗ and select your account.
- Click Stream > Live Inputs.
- Click a live input from the list to select it. The page for your live input displays.
- Locate the Embed and HLS Manifest URL beneath the video.
- Determine which option to use and then click Click to copy beneath your choice.
You can use one of the options below to view a live video by input ID:
- Replace the video ID with the input ID.
- Use the Embed code.
- Use the Manifest URL.
You can check whether a live input ID is currently streaming a video or not by making a request to the lifecycle
endpoint. The Stream player supports using input IDs to check a live stream status, but third party players may require additional support.
In the example below, the response indicates the ID
is for an input with an active videoUID
. The live
status value indicates the input is actively streaming.
When viewing a live stream via the live input ID, the requireSignedURLs
and allowedOrigins
options in the live input recording settings are used. These settings are independent of the video-level settings.
After a live stream ends, a recording is automatically generated and available within 60 seconds. To ensure successful video viewing and playback, keep the following in mind:
- If a live stream ends while a viewer is watching, viewers using the Stream player should wait 60 seconds and then reload the player to view the recording of the live stream.
- After a live stream ends, you can check the status of the recording via the API. When the video state is
ready
, you can use one of the manifest URLs to stream the recording.
While the recording of the live stream is generating, the video may report as not-found
or not-started
.
If you are not using the Stream player for live stream recordings, refer to Record and replay live streams for more information on how to replay a live stream recording.