Skip to main content

Heartbeat

Heartbeat is an add-on functionality to the Quickplay Player that facilitates stream concurrency maintenance, maintaining last played position (for VOD) and enforcing geo-restrictions. For Live Streams, Heartbeat can notify the application of all applicable events during the stream.

The corresponding Authorization response for that playback holds the relevant information that indicates whether the Heartbeat service is applicable for that playback.

Authorization Response Parameters

NameDescription
heartbeatFlagIndicates whether heartbeat should be attached for the current playback (e.g., not required for blacked-out streams or certain VOD types).
heartbeatFreqThe recommended heartbeat sync interval in milliseconds.
heartbeatTokenThe unique heartbeat token for the current playback.
liveStartTimeStart time of the current live program/event.
liveEndTimeEnd time of the current live program/event.
liveEventTypeThe type of LIVE event (e.g., regular or overflow). Applicable only for live events.

Heartbeat Configuration

NameRequiredDescription
heartbeatServiceEndpointtrueHeartbeat service endpoint URL.
streamConcurrencyServiceEndpointfalseStream Concurrency service endpoint URL.
heartbeatTokentrue*Unique heartbeat token received from the authorization response. Required when heartbeat is enabled.
contentIdtrueUnique identifier of the content being played.
heartbeatSyncIntervalMsfalseInterval in milliseconds used to periodically send heartbeat updates. Default: 60000 ms.
heartbeatMaxAllowedFailuresfalseMaximum number of consecutive failed heartbeat attempts allowed before terminating live playback. Default: 2.
recordBookmarkfalseIndicates whether to record bookmarks/resume positions for VOD content using heartbeat. Default: false.
multiStreamModefalseIndicates whether multiple player instances are streaming simultaneously on the device.
stopPlayerOnStreamTimelineEventfalseIndicates whether playback should stop when a stream timeline event (e.g., live event end) occurs.
showPostEventSlateTimeMsfalseDuration (in milliseconds) to play post-event slate content after a live event ends.
trackViewersCountfalseIndicates whether viewer count tracking is enabled. Default: false.
liveStartTimefalseStart time of the live event (ISO string). Applicable only for live content.
liveEndTimefalseEnd time of the live event (ISO string). Applicable only for live content.
live360StartTimefalseStart time of the Live 360 event (if applicable).
live360EndTimefalseEnd time of the Live 360 event (if applicable).
pgmStartTimefalseProgram start time within the live event timeline.
pgmEndTimefalseProgram end time within the live event timeline.
overflowModefalseIndicates overflow handling mode when applicable to live events.
liveEventTypefalseType of live event (e.g., regular, overflow).
heartbeatHeadersfalseAdditional custom headers to be included in heartbeat requests.
platformClientfalseInstance of PlatformClient used for authenticated service communication.
import { HeartbeatConfig, createPlayer, PlayerConfig } from '@quickplay/rn-qp-nxg-player';

const heartbeatConfiguration: HeartbeatConfig = {
streamConcurrencyServiceEndpoint: <streamConcurrencyServiceEndpoint>,
heartbeatServiceEndpoint: <heartbeatServiceEndpoint>,
heartbeatToken: contentAuthToken.heartbeatToken,
contentId: <contentId>,
heartbeatSyncIntervalMs: 60000,
platformClient: <platformClient>,
liveStartTime: contentAuthToken.liveStartTime,
liveEndTime: contentAuthToken.liveEndTime,
trackViewersCount: platformData.trackViewersCount,
live360StartTime: contentAuthToken.live360StartTime,
live360EndTime: contentAuthToken.live360EndTime,
pgmStartTime: contentAuthToken.pgmStartTime,
pgmEndTime: contentAuthToken.pgmEndTime,
multiStreamMode: true // false,
};

const playerConfig: PlayerConfig = {
heartbeatConfig: heartbeatConfiguration
}

const player = await createPlayer(playerConfig)