How do I set up and use Replay?
Replay allows users to view replays on any single stream in the channel that was available during the duration of the replay. When a client requests a replay, the Phenix platform finds a stream that was running during the entire requested period and serves an HLS manifest containing chunks from that stream. See the examples below.
When forking a stream, replay can be enabled on the forked stream by adding the time-shift-manifest
capability to the forked stream even if the original does not have this capability.
Stream and Subscriber Setup
To use replay, both the publishing and subscribing capabilities must be set as described below.
For publishing:
-
Set the
time-shift-manifest
capability in the publishing token, as well as theon-demand
andstreaming
capabilities. -
Configure the Channel to use High Availability (HA).
For subscription tokens:
-
Set the
replay
capability in the viewing token. -
The expiration of the token should extend past the expected end of the event (to cover the case of overtime in games). The expiration time must be the same for all viewers.
-
The sessionId should not be included in the viewing token.
-
The token values must be the same for all viewers of an event.
Additional requirements:
-
One or more real-time streams must exist that span the entire duration of the desired replay. The published streams must overlap to avoid discontinuities. See the examples below.
-
The mobile SDK client's SDK version must be at least SDK v2021.0.14.
Using the Manifest
To fetch the replay manifest for use in playing back the stream, use the Fetching a Replay Manifest API.
Examples
Examples 1-4
Replay will work for all four cases shown below, as each replay is complete within a single stream. All four replays will be available for all users.
Example 5
In this case, no replay will be created as there is no single stream that covers the replay time R5.
Example 6
In this case, no replay will be created as there is no single stream that covers the replay time R6, and there is a gap during the replay time R6.