Constructor
new PillarboxMonitoring(player, optionsopt)
Creates an instance of PillarboxMonitoring.
| Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
player | Player | The player instance to be monitored  | |||||||||||||||||||||||||||||||||||||
options | PillarboxMonitoringOptions | <optional> | {} | Configuration options for the monitoring Properties
  | 
Members
beaconUrl :string
- string
 
currentSessionId :string
- string
 
heartbeatInterval :Number
- Number
 
lastPlaybackDuration :Number
- Number
 
lastPlaybackStartTimestamp :Number
- Number
 
lastStallCount :Number
- Number
 
lastStallDuration :Number
- Number
 
loadStartTimestamp :Number
- Number
 
mediaAssetUrl :string
- string
 
mediaId :string
- string
 
mediaMetadataUrl :string
- string
 
mediaOrigin :string
- string
 
metadataRequestTime :Number
- Number
 
platform :string
- string
 
player :module:video.js/dist/types/player~default
- module:video.
js/dist/types/player~default  
playerName :string
- string
 
playerVersion :string
- string
 
schemaVersion :string
- string
 
tokenRequestTime :Number
- Number
 
Methods
addListeners()
Adds event listeners to the player and the window.
bandwidth() → {number|undefined}
The current bandwidth of the last segment download.
The current bandwidth in bits per second, undefined otherwise.
- Type:
 - number |
undefined  
bindCallBacks()
Binds the callback functions to the current instance.
bufferDuration() → {Number}
Get the buffer duration in milliseconds.
The buffer duration
- Type:
 - Number
 
currentAudioTrack() → {string|undefined}
Gets the language of the current audio track.
The language of the current audio track, or undefined if no audio track is available or if the language is not set.
- Type:
 - string |
undefined  
currentSourceMediaData() → {Object}
The media data of the current source.
The media data of the current source, or an empty object if no media data is available.
- Type:
 - Object
 
currentTextTrack() → {string|undefined}
Gets the language of the current text track (subtitles or captions).
The language of the current text track, or undefined if no text track is available or if the language is not set.
- Type:
 - string |
undefined  
error()
Handles player errors by sending an ERROR event, then resets the session.
getDrmRequestDuration() → {number|undefined}
Get the DRM license request duration from performance API.
The request duration
- Type:
 - number |
undefined  
getTokenRequestDuration() → {number|undefined}
Get the Akamai token request duration from performance API.
The request duration
- Type:
 - number |
undefined  
heartbeat()
Send an 'HEARTBEAT' event with the date of the current playback state at regular intervals.
isTrackerDisabled() → {Boolean}
Check if the tracker is disabled.
true if disabled false otherwise.
- Type:
 - Boolean
 
loadStart()
Handles loadstart event and captures the current timestamp. Will be used to calculate the media loading time.
loadedData()
Handles the session start by sending a START event immediately followed by a HEARTBEAT when the loadeddata event is triggered.
playbackDuration() → {number}
The total playback duration for the current session.
The total playback duration in milliseconds.
- Type:
 - number
 
playbackStart()
Assign the timestamp each time the playback starts.
playbackStop()
Calculates and accumulates the duration of the playback session each time the playback stops for the current media.
removeListeners()
Removes all event listeners from the player and the window.
removeTokenFromAssetUrl(assetUrl) → {string|undefined}
Remove the token from the asset URL.
| Name | Type | Description | 
|---|---|---|
assetUrl | string | The URL of the asset  | 
The URL without the token, or undefined if the input URL is invalid
- Type:
 - string |
undefined  
reset(event)
Resets the playback session and clears relevant properties.
| Name | Type | Description | 
|---|---|---|
event | Event | The event that triggered the reset. If the event type is not 'ended' or 'playerreset', listeners will be removed.  | 
sendEvent(eventName, dataopt)
Sends an event to the server using the Beacon API.
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
eventName | string | Either START, STOP, ERROR, HEARTBEAT  | ||
data | Object | <optional> | {} | The payload object to be sent. Defaults to an empty object if not provided  | 
sessionStart()
Starts a new session by first stopping the previous session, then resetting the session start timestamp and media ID to their new values.
sessionStop(eventopt)
Stops the current session by sending a STOP event and resetting the session.
| Name | Type | Attributes | Description | 
|---|---|---|---|
event | Event | <optional> | The event that triggered the stop. This is passed to the reset function.  | 
stalled()
Handles the stalled state of the player. Sets the stalled state and listens for the event that indicates the player is no longer stalled.
(static) deviceId() → {string|undefined}
Retrieve or generate a unique device ID and stores it in localStorage.
The device ID if localStorage is available, otherwise undefined
- Type:
 - string |
undefined  
(static) errorKeyCode(code) → {string}
Returns a string representing the error key combined with its error code.
If the error code doesn't exist the error key undefined.
| Name | Type | Description | 
|---|---|---|
code | number | The error code  | 
The error key combined with its error code
- Type:
 - string
 
(static) randomUUID() → {string}
Generate a cryptographically secure random UUID.
- Type:
 - string
 
(static) secondsToMilliseconds(seconds) → {number}
converts seconds into milliseconds.
| Name | Type | Description | 
|---|---|---|
seconds | number | 
milliseconds as an integer value
- Type:
 - number
 
(static) sessionId() → {string}
Generates a new session ID.
random UUID
- Type:
 - string
 
(static) timestamp() → {number}
The timestamp in milliseconds.
milliseconds as an integer value
- Type:
 - number
 
(static) userAgent() → {string}
The browser's user agent.
- Type:
 - string
 
pillarbox-web