Skip to main content
Your SDK Description - Documentation

JavaScript SDK Docs JavaScript SDK Docs

Global

Members

(constant) CONTROLS_DISPLAY :string

Position and visibility for the player control bar.

Properties:
Name Type Description
BOTTOM string

Display the control bar at the bottom of the player

TOP string

Display the control bar at the top of the player

NONE string

Don't display the control bar

Example
unit.controlsDisplay = CONTROLS_DISPLAY.NONE;

(constant) EVENT_STATE :string

Event lifecycle state.

Properties:
Name Type Description
UNLOADED string

Event hasn't yet been loaded

PRELOADING string

Event is preloading

PRELOADED string

Event has successfully preloaded

FAILED string

Event has failed rendering

TRIGGERED string

Event has started

FINISHED string

Event has finished

(constant) EVENTS :string

Types of events that can be tracked to web services. Provide these as keys to the MediaUnit.trackingURLs object. Provide the URL to be retrieved as the corresponding value.

Properties:
Name Type Description
LAUNCH string

Invoked on unit startup

FINISH string

Invoked on unit finish

EXIT_FULLSCREEN string

Invoked when exiting fullscreen mode

FULLSCREEN string

Invoked when entering fullscreen mode

IMPRESSION string

Invoked once the unit starts playing

IMPRESSION_VIEWABLE string

Invoked if the impression is viewable

IMPRESSION_NOT_VIEWABLE string

Invoked if the impression is not viewable

IMPRESSION_UNDETERMINED string

Invoked if the impression viewability is undetermined

CREATIVE_VIEW string

Invoked once the unit starts playing

START string

Invoked once the unit starts playing

RESUME string

Invoked once the unit resumes playing

PAUSE string

Invoked once the unit pauses

REWIND string

Invoked once the unit starts rewinding

FORWARD string

Invoked once the unit starts seeking forward

MUTE string

Invoked once the unit gets muted

UNMUTE string

Invoked once the unit gets unmuted

ERROR string

Invoked on error

COMPLETE string

Invoked once the unit finishes playing

CLOSE string

Invoked once the unit finishes playing

CLOSE_LINEAR string

Invoked once the unit finishes playing

SKIP string

Invoked once the unit is skipped

CLICK string

Invoked once the unit is clicked/tapped

ICON_VIEW string

Invoked once the industry icon is displayed

EXPAND string

Invoked once an overlay ad is expanded

COLLAPSE string

Invoked once an overlay ad is collapsed

UPDATE string

Invoked every second, while the player is playing

SEEKED string

Invoked after seek

POSITION string

Invoked on SSAI ad quartile tracking

SSAI_AD_STARTED string

Invoked on SSAI ad started

SSAI_AD_ENDED string

Invoked on SSAI ad ended

Example
const unit = new MediaUnit(videoUrl);
unit.trackingURLs = {
   [EVENTS.LAUNCH]: 'https://analyticsservice.com/pixel',
   [EVENTS.COMPLETE]: 'https://analyticsservice.com/pixel',
};

(constant) FINISH_REASON :string

Represents the reason for a NOTIFICATIONS.UNIT_FINISHED event. The value is set on the reason key of the event metadata object.

Properties:
Name Type Description
PLAYBACK_ENDED string

Playback stopped because the unit ended

PLAYBACK_ERROR string

Playback stopped because of an error

USER_EXITED string

Playback was stopped by the user

Example
const tracker = player.getEventTracker();
tracker.emitter.on(NOTIFICATIONS.UNIT_FINISHED, ({ reason, unit }) => {
   console.log(`Unit ${unit.url} finished with reason ${reason}`);
   if (reason === FINISH_REASON.USER_EXITED) {
     console.log('User exited');
   }
});

(constant) NOTIFICATIONS :string

Types of notifications that are emitted by the player.

Properties:
Name Type Description
TOGGLE_FULLSCREEN string

Emitted when fullscreen mode is toggled

ENTER_FULLSCREEN string

Emitted when fullscreen mode is entered

EXIT_FULLSCREEN string

Emitted when fullscreen mode is exited

CONTROLS_DISPLAYED string

Emitted when the control bar is displayed

CONTROLS_HIDDEN string

Emitted when the control bar is hidden

UNIT_FINISHED string

Emitted when a unit finishes playback

ERROR string

Emitted on error

TRACKED_EVENT string

Emitted when an event is tracked

INVALID_LICENSE string

Emitted when the player license is invalid

PLAYBACK_STATE_CHANGED string

Emitted when playback state changes

LOAD_STATE_CHANGED string

Emitted when unit load state changes

DURATION_AVAILABLE string

Emitted when unit duration becomes available

VOLUME_CHANGED string

Emitted when volume changes

PLAYLIST_FINISH string

Emitted when a playlist finishes playback

PLAYER_UPDATE string

Emitted every second while the player operates

PLAYER_MOUSE_MOVE string

Emitted once the mouse moves on top of the player area

PLAYER_TAPPED string

Emitted when the player area is clicked/tapped

Example
const tracker = player.getEventTracker();
tracker.emitter.on(NOTIFICATIONS.ENTER_FULLSCREEN, () => {
   console.log('Fullscreen entered');
});

(constant) OVERLAY_POSITION :string

Describes the position an overlay can take in the player view area. Use this to set or read MediaOverlay.position. When configuring from JSON, use readable string constants instead - see the docs.

Properties:
Name Type Description
FULLSCREEN string

Overlay will be displayed in the center of the player view area

BOTTOM_LEFT string

Overlay will be aligned bottom-left with the player view area

BOTTOM_RIGHT string

Overlay will be aligned bottom-right with the player view area

TOP_LEFT string

Overlay will be aligned top-left with the player view area

TOP_RIGHT string

Overlay will be aligned top-right with the player view area

TOP string

Overlay will be aligned with the top player view area

BOTTOM string

Overlay will be aligned with the bottom player view area

LEFT string

Overlay will be aligned with the left of the player view area

RIGHT string

Overlay will be aligned with the right of the player view area

UNSPECIFIED string

Overlay position is unspecified

Example
const overlay = new MediaOverlay(type);
overlay.position = OVERLAY_POSITION.BOTTOM_LEFT;

(constant) OVERLAY_TYPE :string

Built-in overlay types

Properties:
Name Type Description
IMAGE string

Image overlay

HTML string

Text overlay

BUTTON string

Button overlay

TEXT string

Text overlay

SKIP string

Internal

FULLSCREEN string

Internal

CONTROLS string

Internal

SUBTITLES string

Internal

SSAI string

Internal

Example
const overlay = new MediaOverlay(OVERLAY_TYPE.IMAGE)

(constant) PLAYBACK_STATE :string

Represents the current playback state for a player instance.

Properties:
Name Type Description
STOPPED string

Player is currently stopped

PLAYING string

Player is currently playing

PAUSED string

Player is currently paused

INTERRUPTED string

Player is currently interrupted

SEEKING string

Player is currently seeking

Example
if (player.playbackState() === PLAYBACK_STATE.PAUSED) {
   player.play();
}