Skip to content

Commit 227e565

Browse files
committed
[Stream] Initial pass on DVR documentation
1 parent 01f1e61 commit 227e565

File tree

3 files changed

+181
-27
lines changed

3 files changed

+181
-27
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: "Rewind, Replay, Resume: Introducing DVR for Stream Live"
3+
description: >
4+
Stream has added support for DVR for Live broadcasts. In other words, for those
5+
who didn’t witness the magic of TiVo, you can now allow your viewers to rewind
6+
and replay Live content during broadcasts.
7+
products:
8+
- stream
9+
date: 2025-02-12T12:00:00Z
10+
---
11+
12+
13+
Previously, all viewers watched "the live edge," or the latest content of the
14+
broadcast, synchronously. If a viewer paused for more than a few seconds,
15+
the player would automatically "catch up" when playback started again. Seeking
16+
through the broadcast was only available once the recording was available after
17+
it conluded.
18+
19+
Starting today, customers can make a small adjustment to the player
20+
embed or manifest URL to enable the DVR experience for their viewers. By
21+
offering this feature as an opt-in adjustment, our customers are empowered to
22+
pick the best experiences for their applications.
23+
24+
## How to get started
25+
26+
This feature is already available to all customers. When building a player embed
27+
code or manifest URL, add `dvrEnabled=true` as a query parameter. There are some
28+
things to be aware of when using this option. For more information, refer to
29+
[@TODO PLACEHOLDER](/)
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
pcx_content_type: how-to
3+
title: DVR for Live
4+
sidebar:
5+
badge:
6+
text: Beta
7+
---
8+
9+
Stream Live supports "DVR mode" on an opt-in basis to allow viewers to rewind,
10+
resume, and fast-forward a live broadcast. To enable DVR mode, simply add the
11+
`dvrEnabled=true` query parameter to the Stream Player embed source or the HLS
12+
manigest URL. For example:
13+
14+
``` html title="Embed Code"
15+
<div style="position: relative; padding-top: 56.25%;">
16+
<iframe
17+
src="https://customer-<CODE>.cloudflarestream.com/<INPUT_ID|VIDEO_ID>/iframe?dvrEnabled=true"
18+
style="border: none; position: absolute; top: 0; left: 0; height: 100%; width: 100%;"
19+
allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;"
20+
allowfullscreen="true"
21+
></iframe>
22+
</div>
23+
```
24+
25+
When DVR mode is enabled the Stream Player will:
26+
27+
- Show a timeline the viwer can scrub/seek, like when watching an on-demand video
28+
the timeline will automatically scale to show the growing duration of the broadcast.
29+
- The "LIVE" indicator will show grey if the viewer is behind the live edge or
30+
red if they are watching the latest content. Clicking that indicator will jump
31+
back to the live edge.
32+
- If the viewer pauses the player, it will resume playback from that time instead
33+
of jumping forward to the live edge.
34+
35+
``` text title="HLS Manifest"
36+
https://customer-<CODE>.cloudflarestream.com/<INPUT_ID|VIDEO_ID>/manifest/video.m3u8?dvrEnabled=true
37+
```
38+
39+
Custom players using a DVR-capable HLS manifest may need additional
40+
configuration to surface helpful controls or information. Refer to your player
41+
library for additional information.
42+
43+
## Video ID or Input ID
44+
45+
Stream Live allows loading the Player or HLS manifest by Video ID or Live Input
46+
ID. See [Watch a live stream](/stream/stream-live/watch-live-stream/) for how to
47+
retrieve these URLs and compare these options. There are additional
48+
considerations when using DVR mode:
49+
50+
**Recommended:** When using DVR Mode on a Video ID URL:
51+
52+
- When the player loads, it will start playing the active broadcast if it is
53+
still live, or its recording if the broadcast has concluded.
54+
55+
When using DVR Mode on a Live Input ID URL:
56+
57+
- When the player loads, it will start playing the currently live broadcast if
58+
there is one (see [Live Input Status](/stream/stream-live/watch-live-stream/#live-input-status)).
59+
- If the viewer is still watching _after the broadcast ends,_ they can continue
60+
to watch. However, if the player or manifest is then reloaded, it will show the
61+
latest broadcast or "Stream has not yet started" (`HTTP 204`). Past broadcasts
62+
are not available by Live Input ID.
63+
64+
## Known Limitations
65+
66+
- When using DVR Mode and a player/manifest created using a Live Input ID, if a
67+
viewer is still watching after a broadcast has concluded, the player may stall
68+
when trying to switch quality levels.
69+
- There is no enforced limit to the maximum duration of a DVR manifest, however
70+
performance may be degraded for DVR manifests longer than 3 hours.
71+
- DVR Mode relies on Version 8 of the HLS manifest specification, which is newer
72+
than Version 6, which Stream Live and On-Demand currently use. HLS v8 offers
73+
extremely broad compatibility but may not work with certain old player libraries
74+
or older devices.

src/content/docs/stream/stream-live/watch-live-stream.mdx

Lines changed: 78 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,90 @@ sidebar:
1010

1111
import { Render } from "~/components"
1212

13-
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`.
13+
When a [Live Input](/stream/stream-live/start-stream-live/) begins receiving a
14+
broadcast, a new video is automatically created if the input's `mode` property
15+
is set to `automatic`.
16+
17+
To watch, Stream offers a built-in Player or you use a custom player with the
18+
HLS and DASH manifests.
1419

1520
<Render file="chromecast_limitations" />
1621

17-
## Use the API
22+
## View by Live Input ID or Video ID
23+
24+
Whether you use the Stream Player or a custom player with a manifest, you can
25+
reference the Live Input ID or a specific Video ID. The difference is what
26+
happens when a broadcast concludes.
27+
28+
Use a Live Input ID in instances where a player should always show the active
29+
broadcast, if there is one, or a "Stream has not started" message if the input
30+
is idle. Best for cases where a page is dedicated to a creator, channel,
31+
recurring program. The Live Input ID is provisioned for you when you create the
32+
input; it will not change.
33+
34+
Use a Video ID in instances where a player should be used to display a single
35+
broadcast or its recording once the broadcast has conluded. Best for cases where
36+
a page is dedicated to a one-time event, specific episode/occurance, or date.
37+
There is a _new_ Video ID generated for each broadcast when it starts.
38+
39+
Using DVR mode, explaind below, there are additional considerations.
40+
41+
Stream's URLs are all templatized for easy generation:
42+
43+
**Stream built-in Player URL format:**
44+
45+
```
46+
https://customer-<CODE>.cloudflarestream.com/<INPUT_ID|VIDEO_ID>/iframe
47+
```
48+
49+
A full embed code can be generated in Dash or with the API.
50+
51+
**HLS Manifest URL format:**
52+
53+
```
54+
https://customer-<CODE>.cloudflarestream.com/<INPUT_ID|VIDEO_ID>/manifest/video.m3u8
55+
```
56+
57+
You can also retrieve the embed code or manifest URLs from Dash or the API.
58+
59+
## Use the dashboard
60+
61+
To get the Stream built-in player embed code or HLS Manifest URL for a custom player:
62+
63+
1. Log in to your [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
64+
2. Click **Stream** > **Live Inputs**.
65+
3. Click a live input from the list.
66+
4. Locate the **Embed** and **HLS Manifest URL** beneath the video.
67+
5. Determine which option to use and then click **Click to copy** beneath your choice.
68+
69+
These will reference the Live Input ID.
1870

19-
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.
71+
## Use the API
2072

21-
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.
73+
To retrieve the player code or manifest URLs via the API, fetch the Live Input's
74+
list of videos:
2275

2376
```bash title="Request"
2477
curl -X GET \
2578
-H "Authorization: Bearer <API_TOKEN>" \
2679
https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/stream/live_inputs/<LIVE_INPUT_UID>/videos
2780
```
2881

29-
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`.
82+
A live input will have multiple videos associated with it, one for each broadcast.
83+
If there is an active broadcast, the first video in the response will have a
84+
`live-inprogress` status. Other videos in the response represent recordings
85+
which can be played on-demand.
86+
87+
Each video in the response, including the active broadcast if there is one,
88+
contains the HLS and DASH URLs and a link to the Stream player. Noteworthy
89+
properties include:
90+
91+
- `preview` -- Link to the Stream player to watch
92+
- `playback`.`hls` -- HLS Manifest
93+
- `playback`.`dash` -- DASH Manifest
94+
95+
In the example below, the state of the live video is `live-inprogress` and the
96+
state for previously recorded video is `ready`.
3097

3198
```json title="Response" {4,7,21,28,32,46}
3299
{
@@ -83,32 +150,17 @@ The response contains the HLS/DASH URL that can be used to play the current live
83150
}
84151
```
85152

86-
## Use the dashboard
153+
## Live input status
87154

88-
To get the embed code or HLS Manifest URL for your video:
89-
90-
1. Log in to your [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
91-
2. Click **Stream** > **Live Inputs**.
92-
3. Click a live input from the list to select it. The page for your live input displays.
93-
4. Locate the **Embed** and **HLS Manifest URL** beneath the video.
94-
5. Determine which option to use and then click **Click to copy** beneath your choice.
95-
96-
## View by live input ID
97-
98-
You can use one of the options below to view a live video by input ID:
99-
100-
* Replace the video ID with the input ID.
101-
* Use the Embed code.
102-
* Use the Manifest URL.
103-
104-
## Live input ID status
105-
106-
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.
155+
You can check whether a live input is currently streaming and what its active
156+
video ID is by making a request to its `lifecycle` endpoint. The Stream player
157+
does this automatically to show a note when the input is idle. Custom players
158+
may require additional support.
107159

108160
```bash
109161
curl -X GET \
110162
-H "Authorization: Bearer <API_TOKEN>" \
111-
https://customer-f33zs165nr7gyfy4.cloudflarestream.com/6b9e68b07dfee8cc2d116e4c51d6a957/lifecycle
163+
https://customer-<CODE>.cloudflarestream.com/<INPUT_ID>/lifecycle
112164
```
113165

114166
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.
@@ -141,4 +193,3 @@ After a live stream ends, a recording is automatically generated and available w
141193
While the recording of the live stream is generating, the video may report as `not-found` or `not-started`.
142194

143195
If you are not using the Stream player for live stream recordings, refer to [Record and replay live streams](/stream/stream-live/replay-recordings/) for more information on how to replay a live stream recording.
144-

0 commit comments

Comments
 (0)