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
| Name | Description |
|---|---|
| heartbeatFlag | Indicates whether heartbeat should be attached for the current playback (e.g., not required for blacked-out streams or certain VOD types). |
| heartbeatFreq | The recommended heartbeat sync interval in milliseconds. |
| heartbeatToken | The unique heartbeat token for the current playback. |
| liveStartTime | Start time of the current live program/event. |
| liveEndTime | End time of the current live program/event. |
| liveEventType | The type of LIVE event (e.g., regular or overflow). Applicable only for live events. |
Heartbeat Configuration
| Name | Required | Description |
|---|---|---|
| heartbeatServiceEndpoint | true | Heartbeat service endpoint URL. |
| streamConcurrencyServiceEndpoint | false | Stream Concurrency service endpoint URL. |
| heartbeatToken | true* | Unique heartbeat token received from the authorization response. Required when heartbeat is enabled. |
| contentId | true | Unique identifier of the content being played. |
| heartbeatSyncIntervalMs | false | Interval in milliseconds used to periodically send heartbeat updates. Default: 60000 ms. |
| heartbeatMaxAllowedFailures | false | Maximum number of consecutive failed heartbeat attempts allowed before terminating live playback. Default: 2. |
| recordBookmark | false | Indicates whether to record bookmarks/resume positions for VOD content using heartbeat. Default: false. |
| multiStreamMode | false | Indicates whether multiple player instances are streaming simultaneously on the device. |
| stopPlayerOnStreamTimelineEvent | false | Indicates whether playback should stop when a stream timeline event (e.g., live event end) occurs. |
| showPostEventSlateTimeMs | false | Duration (in milliseconds) to play post-event slate content after a live event ends. |
| trackViewersCount | false | Indicates whether viewer count tracking is enabled. Default: false. |
| liveStartTime | false | Start time of the live event (ISO string). Applicable only for live content. |
| liveEndTime | false | End time of the live event (ISO string). Applicable only for live content. |
| live360StartTime | false | Start time of the Live 360 event (if applicable). |
| live360EndTime | false | End time of the Live 360 event (if applicable). |
| pgmStartTime | false | Program start time within the live event timeline. |
| pgmEndTime | false | Program end time within the live event timeline. |
| overflowMode | false | Indicates overflow handling mode when applicable to live events. |
| liveEventType | false | Type of live event (e.g., regular, overflow). |
| heartbeatHeaders | false | Additional custom headers to be included in heartbeat requests. |
| platformClient | false | Instance 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)