new MediaHeartbeat(delegate, config, appMeasurement)
Creates an instance of MediaHeartbeat class with provided delegate
Parameters:
Name | Type | Description |
---|---|---|
delegate |
MediaHeartbeatDelegate | Instance of MediaHeartbeatDelegate class |
config |
MediaHeartbeatConfig | Instance of MediaHeartbeatConfig class |
appMeasurement |
object | Instance of AppMeasurement class |
Members
(static, readonly) MediaType :string
Properties:
Name | Type | Description |
---|---|---|
Video |
string | Constant defining media type for Video streams |
Audio |
string | Constant defining media type for Audio streams |
These constants define the type of media
Type:
- string
(static, readonly) Event :string
Properties:
Name | Type | Description |
---|---|---|
AdBreakStart |
string | Constant defining event type for AdBreak start |
AdBreakComplete |
string | Constant defining event type for AdBreak complete |
AdStart |
string | Constant defining event type for Ad start |
AdComplete |
string | Constant defining event type for Ad complete |
AdSkip |
string | Constant defining event type for Ad skip |
ChapterStart |
string | Constant defining event type for Chapter start |
ChapterComplete |
string | Constant defining event type for Chapter complete |
ChapterSkip |
string | Constant defining event type for Chapter skip |
SeekStart |
string | Constant defining event type for Seek start |
SeekComplete |
string | Constant defining event type for Seek complete |
BufferStart |
string | Constant defining event type for Buffer start |
BufferComplete |
string | Constant defining event type for Buffer complete |
BitrateChange |
string | Constant defining event type for change in Bitrate |
TimedMetadataUpdate |
string | Constant defining event type for TimedMetadata updates received from the player |
These constants define the type of tracking event
Type:
- string
(static, readonly) StreamType :string
Properties:
Name | Type | Description |
---|---|---|
VOD |
string | Constant defining stream type for VOD streams |
LIVE |
string | Constant defining stream type for Live streams |
LINEAR |
string | Constant defining stream type for Linear streams |
PODCAST |
string | Constant defining stream type for Podcast streams |
AUDIOBOOK |
string | Constant defining stream type for AudioBook streams |
AOD |
string | Constant defining stream type for AOD streams |
These constants define the stream type of the main content.
Type:
- string
(static, readonly) MediaObjectKey :string
Properties:
Name | Type | Description |
---|---|---|
StandardVideoMetadata |
string | Constant defining Map of Standard Video Metadata to be attached on MediaObject. |
StandardMediaMetadata |
string | Constant defining Map of Standard Media Metadata to be attached on MediaObject |
StandardAdMetadata |
string | Constant defining Map of Standard Ad Metadata to be attached on MediaObject |
VideoResumed |
string | Constant defining explicit video resumed property. Set this to true on MediaObject if resuming a previously closed session. |
MediaResumed |
string | Constant defining explicit media resumed property. Set this to true on MediaObject if resuming a previously closed session. |
PrerollTrackingWaitingTime |
string | Constant defining the amount of time that MediaHeartbeat will wait between trackPlay and trackEvent(AdBreakStart) before tracking the start of media. |
Type:
- string
(static, readonly) VideoMetadataKeys :string
Valid video metadata keys:SHOW
SEASON
EPISODE
ASSET_ID
GENRE
FIRST_AIR_DATE
FIRST_DIGITAL_DATE
RATING
ORIGINATOR
NETWORK
SHOW_TYPE
AD_LOAD
MVPD
AUTHORIZED
DAY_PART
FEED
STREAM_FORMAT
Type:
- string
(static, readonly) AudioMetadataKeys :string
Valid audio metadata keys:ARTIST
ALBUM
LABEL
AUTHOR
STATION
PUBLISHER
Type:
- string
(static, readonly) AdMetadataKeys :string
Valid ad metadata keys:ADVERTISER
CAMPAIGN_ID
CREATIVE_ID
PLACEMENT_ID
SITE_ID
CREATIVE_URL
Type:
- string
Methods
(static) createMediaObject(name, mediaId, length, mediaStreamType, mediaType)
Creates an instance of the media info object
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the media |
mediaId |
string | The unique identifier for the media |
length |
number | The length of the media in seconds |
mediaStreamType |
string | The stream type of the media. Use MediaHeartbeat.StreamType or custom values to denote the stream type of media. |
mediaType |
MediaHeartbeat.MediaType | The media type |
(static) createAdBreakObject(name, position, startTime)
Creates an instance of the AdBreak info object
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the ad break |
position |
number | The position of the ad break in the content starting with 1 |
startTime |
number | The start time of the ad break relative to the main media |
(static) createAdObject(name, adId, position, length)
Creates an instance of the Ad info object
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the ad |
adId |
string | The unique id for the ad |
position |
number | The start position of the ad |
length |
number | The length of the ad in seconds |
(static) createChapterObject(name, position, length, startTime)
Creates an instance of the Chapter info object
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the chapter |
position |
number | The position of the chapter |
length |
number | The length of the chapter in seconds |
startTime |
number | The start time of the chapter relative to the main media |
(static) createQoSObject(bitrate, startupTime, fps, droppedFrames)
Creates an instance of the QoS info object
Parameters:
Name | Type | Description |
---|---|---|
bitrate |
number | The bitrate of media in bits per second |
startupTime |
number | The start up time of media in seconds |
fps |
number | The current frames per second information |
droppedFrames |
number | The number of dropped frames so far |
(static) createTimedMetadataObject(metadata)
Creates an instance of the Timed Metadata media object
Parameters:
Name | Type | Description |
---|---|---|
metadata |
string | The timed metadata string value |
(static) version()
Static method to get the version.
Returns:
a string containing the version value.
trackSessionStart(mediaInfo, contextData)
Method to load media information and track the start of a viewing session.
Parameters:
Name | Type | Description |
---|---|---|
mediaInfo |
object | MediaObject instance created using MediaHeartbeat.createMediaObject method |
contextData |
object | Object containing the context data to be tracked. |
trackPlay()
Method to track media play or resume after a previous pause.
trackPause()
Method to track media pause.
trackComplete()
Method to track completion of media.
trackSessionEnd()
Method to track the end of a viewing session. This method must be called even if the user
does not watch the media to completion.
trackError(errorId)
Method to track an error in media playback
Parameters:
Name | Type | Description |
---|---|---|
errorId |
string | Error Id |
trackEvent(event, info, data)
Method to track an event in media playback.
Parameters:
Name | Type | Description |
---|---|---|
event |
MediaHeartbeat.Event | Event to be tracked. |
info |
object | MediaObject of the Event to be tracked. |
data |
object | Context data for MediaHeartbeat.Event#AdStart and MediaHeartbeat.Event#ChapterStart events. Pass null for other events. |