public class MediaHeartbeat
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
MediaHeartbeat.AdMetadataKeys
These constant strings define standard metadata keys for ads.
|
static class |
MediaHeartbeat.AudioMetadataKeys
These constant strings define standard metadata keys for audio content.
|
static class |
MediaHeartbeat.Event
These enumeration values define the type of a tracking event
|
static interface |
MediaHeartbeat.MediaHeartbeatDelegate
Interface defining protocol for fetching regular playhead updates and QoS values from media player.
|
static class |
MediaHeartbeat.MediaObjectKey
These constant strings define media/ad info keys used for MediaObject.
|
static class |
MediaHeartbeat.MediaType
These enumeration values define the type of media
|
static class |
MediaHeartbeat.StreamType
These constant strings define the stream type of the main content that is currently tracked.
|
static class |
MediaHeartbeat.VideoMetadataKeys
These constant strings define standard metadata keys for video content.
|
Constructor and Description |
---|
MediaHeartbeat(MediaHeartbeat.MediaHeartbeatDelegate delegate,
MediaHeartbeatConfig config)
Creates an instance of MediaHeartbeat class with provided delegate
|
Modifier and Type | Method and Description |
---|---|
static MediaObject |
createAdBreakObject(java.lang.String name,
java.lang.Long position,
java.lang.Double startTime)
Creates an instance of the AdBreak info object
|
static MediaObject |
createAdObject(java.lang.String name,
java.lang.String adId,
java.lang.Long position,
java.lang.Double length)
Creates an instance of the Ad info object
|
static MediaObject |
createChapterObject(java.lang.String name,
java.lang.Long position,
java.lang.Double length,
java.lang.Double startTime)
Creates an instance of the Chapter info object
|
static MediaObject |
createMediaObject(java.lang.String name,
java.lang.String mediaId,
java.lang.Double length,
java.lang.String streamType)
Deprecated.
|
static MediaObject |
createMediaObject(java.lang.String name,
java.lang.String mediaId,
java.lang.Double length,
java.lang.String streamType,
MediaHeartbeat.MediaType mediaType)
Creates an instance of the media info object for Audio or Video streams
|
static MediaObject |
createQoSObject(java.lang.Long bitrate,
java.lang.Double startupTime,
java.lang.Double fps,
java.lang.Long droppedFrames)
Creates an instance of the QoS info object
|
static MediaObject |
createTimedMetadataObject(java.lang.String metadata)
Creates an instance of the Timed Metadata media object
|
void |
trackComplete()
Method to track completion of media.
|
void |
trackError(java.lang.String errorId)
Method to track Player Errors.
|
void |
trackEvent(MediaHeartbeat.Event event,
MediaObject info,
java.util.Map<java.lang.String,java.lang.String> contextData)
Method to track optional media events.
|
void |
trackPause()
Method to track media pause.
|
void |
trackPlay()
Method to track media play or resume after pause.
|
void |
trackSessionEnd()
Method to track the end of a viewing session.
|
void |
trackSessionStart(MediaObject mediaInfo,
java.util.Map<java.lang.String,java.lang.String> contextData)
Method to track the start of viewing session.
|
static java.lang.String |
version()
Gets the version.
|
public MediaHeartbeat(MediaHeartbeat.MediaHeartbeatDelegate delegate, MediaHeartbeatConfig config)
delegate
- MediaHeartbeatDelegate instance returning valid playhead and QoS updatesconfig
- MediaHeartbeatConfig instance with valid config valuespublic static MediaObject createMediaObject(java.lang.String name, java.lang.String mediaId, java.lang.Double length, java.lang.String streamType)
createMediaObject(String, String, Double, String, MediaType)
insteadname
- The name of the mediamediaId
- The unqiue identifier for the medialength
- The length of the media in secondsstreamType
- The stream type as a string. Use MediaHeartbeat.StreamType
for predefined streams.public static MediaObject createMediaObject(java.lang.String name, java.lang.String mediaId, java.lang.Double length, java.lang.String streamType, MediaHeartbeat.MediaType mediaType)
name
- The name of the mediamediaId
- The unqiue identifier for the medialength
- The length of the media in secondsstreamType
- The stream type as a string. Use MediaHeartbeat.StreamType
for predefined streams.mediaType
- The media typepublic static MediaObject createAdBreakObject(java.lang.String name, java.lang.Long position, java.lang.Double startTime)
name
- The name of the ad breakposition
- The position of the ad break in the content starting with 1startTime
- The start time of the ad break relative to the main mediapublic static MediaObject createAdObject(java.lang.String name, java.lang.String adId, java.lang.Long position, java.lang.Double length)
name
- The name of the adadId
- The unique id for the adposition
- The start position of the adlength
- The length of the ad in secondspublic static MediaObject createChapterObject(java.lang.String name, java.lang.Long position, java.lang.Double length, java.lang.Double startTime)
name
- The name of the chapterposition
- The position of the chapterlength
- The length of the chapter in secondsstartTime
- The start of the chapter relative to the main mediapublic static MediaObject createQoSObject(java.lang.Long bitrate, java.lang.Double startupTime, java.lang.Double fps, java.lang.Long droppedFrames)
bitrate
- The bitrate of media in bits per secondstartupTime
- The start up time of media in secondsfps
- The current frames per second informationdroppedFrames
- The number of dropped frames so farpublic static MediaObject createTimedMetadataObject(java.lang.String metadata)
metadata
- The timed metadata string valuepublic static java.lang.String version()
public void trackSessionStart(MediaObject mediaInfo, java.util.Map<java.lang.String,java.lang.String> contextData)
mediaInfo
- A valid MediaObject instance created using createMediaObject(String, String, Double, String, MediaType)
.contextData
- An optional map containing the context data to be tracked.public void trackPlay()
public void trackPause()
public void trackComplete()
public void trackSessionEnd()
public void trackError(java.lang.String errorId)
public void trackEvent(MediaHeartbeat.Event event, MediaObject info, java.util.Map<java.lang.String,java.lang.String> contextData)
event
- Event type.info
- A valid MediaObject instance containing event info for MediaHeartbeat.Event.AdBreakStart
, MediaHeartbeat.Event.AdStart
and MediaHeartbeat.Event.ChapterStart
contextData
- An optional map containing context data to be tracked for MediaHeartbeat.Event.AdStart
and MediaHeartbeat.Event.ChapterStart
events.