Live Playback
To play a live stream from Quickplay Platform, follow the steps described in Secure Playback, and update the platform asset to indicate you are trying to play a Live stream.
A PlatformAsset
for playing a Live Stream could be constructed with APIs from ContentAuthorizer by providing the following:
- Content Id: Unique identifier of the content
- Media Format: HLS | DASH | SmoothStream
- DRM: Fairplay | Widevine
- Content Type: Live
- Catalog Type: channel | event | sportsliveevent
- Playback Mode: Live | Restart | Catchup
- Start Time: Start time of the Live Program
- Required for playback modes
restart
andcatchup
, optional otherwise
- Required for playback modes
- End Time: End time of the Live Program
- Required for playback mode
catchup
, optional otherwise
- Required for playback mode
// create live streaming asset
const asset = contentAuthorizer.authorizePlayback({
mediaID: platformcontentId.value,
consumptionType: flContentAuthorization.ConsumptionType.LIVE,
catalogType: 'channel',
mediaType: flPlayerInterface.MediaType.DASH,
drmScheme: flPlayerInterface.DrmScheme.WIDEVINE,
playbackMode: flContentAuthorization.PlaybackMode.LIVE,
});
Seeking in live streams
When playing a Live stream, the player always starts playing from the Live Edge. To seek anywhere within the live window, you can use the standard seek
APIs, refer to Basic Playback. The seek position is always relative to the end of the live window. The player will try to maintain the same live offset after a seek.
To force the player to play from Live Edge of the current Live Window, use the seekToLiveEdge
API. The currentOffsetFromLiveEdge
API can be used to determine if the player is currently playing at or beginning the Live Edge.
Listening to live program end
When playing a live program or event, Quickplay platform authorizes the playback for the current action program/event. program/event should be re-authorized again.
When the current live program (restart
, live
modes) ends, player emits the streamtimelineevent
with eventName as StreamTimelineEvent.LIVE_PROGRAM_END
.
player.subscribe("streamtimelineevent", async function (streamTimelineEvent, action, metadata) {
switch (streamTimelineEvent) {
case flPlayerInterface.StreamTimelineEvent.LIVE_PROGRAM_END: {
// Live Program Ended
break;
}
});
Playback Modes
Restart
If you are looking to offer Restart or Play from Beginning feature for your users, setup the asset as shown below.
// create live streaming asset
const asset = contentAuthorizer.authorizePlayback({
mediaID: platformcontentId.value,
consumptionType: flContentAuthorization.ConsumptionType.LIVE,
catalogType: 'channel',
mediaType: flPlayerInterface.MediaType.DASH,
drmScheme: flPlayerInterface.DrmScheme.WIDEVINE,
playbackMode: flContentAuthorization.PlaybackMode.RESTART,
startTime: programStartTime,
endTime: programEndTime
});
Set the intial playback time preference to ensure the live stream plays from beginning of Live Window instead of the Live Edge.
const playerBuilder = flPlayer.createPlayerBuilder();
const playbackOptions = {
initialPlaybackTime: startTimeEpoch,
minBuffer: 30,
maxBuffer: 30,
bufferBehind: 40,
};
const player = playerBuilder
.mediaElement(videoElement)
.mediaUrl(asset.contentUrl)
.drmLicenseUrl(asset.licenseUrl)
.drmScheme(asset.drmScheme)
.playbackOptions(playbackOptions)
.build();
player.play();
Catchup
If you are looking to offer Catchup on an already ended Live program for your users, setup the asset as shown below. The startTime
and endTime
indicate the program start time and end time respectively and these are mandatory when trying to play in catchup
mode.
// create live streaming asset
const asset = contentAuthorizer.authorizePlayback({
mediaID: platformcontentId.value,
consumptionType: flContentAuthorization.ConsumptionType.LIVE,
catalogType: 'channel',
mediaType: flPlayerInterface.MediaType.DASH,
drmScheme: flPlayerInterface.DrmScheme.WIDEVINE,
playbackMode: flContentAuthorization.PlaybackMode.CATCHUP,
startTime: programStartTime,
endTime: programEndTime,
});
seekToLiveEdge
API would be a no-op while playing catchup stream. If you are looking to jump to current live edge of a Catchup
playback, you must re-authorize the playback in live
playbackMode and setup a new player instance.