Skip to main content
Your SDK Description - Documentation

JavaScript SDK Docs JavaScript SDK Docs

MediaOverlay

Extends

A representation of a single overlay, to be displayed on top of a rendered MediaUnit, at specific timestamps.

Constructor

new MediaOverlay(type) → {MediaOverlay}

Constructs a MediaOverlay instance.

Parameters:
Example
const unit = new MediaUnit(videoUrl);
const overlay = new MediaOverlay(OVERLAY_TYPE.IMAGE);
overlay.parameters = { url: imageUrl }
unit.addOverlay(overlay);

Members

(readonly) emitter :EventEmitter

Event emitter. Use this to subscribe to event state changes

Overrides:
Example
event.emitter.on('stateUpdate', () => console.log(`Event state changed to ${event.state}`));

endPoint :string|number

The end time of the event. Accepts an absolute value in seconds or a percentage. Returns -1 if the value depends on the unit duration, which is currently not available.

Overrides:

height :string

Overlay height. Use any valid CSS size like 300px or 100%

Default Value:
  • 100%

(readonly) id :string

A unique identifier assigned by the system.

Overrides:

metadata :Object

Overlay metadata information.

parameters :Object

Overlay configuration parameters. See JSON docs.

(readonly) parentUnit :MediaUnit

The MediaUnit that owns the currently rendered overlay.

Overrides:

(readonly) player :MediaPlayer

Player instance currently rendering the overlay.

Overrides:

position :OVERLAY_POSITION

The overlay position.

Default Value:
  • OVERLAY_POSITION.UNSPECIFIED

preloadInterval :number

How many seconds before scheduled start time should the event start preloading.

Overrides:
Default Value:
  • 5

repeatAfter :number

Set this to configure an event to be re-scheduled during the current playback session after it has finished rendering. Set to the number of seconds to repeat the event after. Set to -1 to disable repeating.

Overrides:
Default Value:
  • -1

startPoint :string|number

The start time of the event. Accepts an absolute value in seconds or a percentage. Returns -1 if the value depends on the unit duration, which is currently not available.

Overrides:

state :EVENT_STATE

Current event state.

Overrides:
Default Value:
  • EVENT_STATE.UNLOADED

timeout :number

How many seconds into preloading should the system give up and discard the event.

Overrides:
Default Value:
  • 10

trackingURLs :Object

A key-value store for tracking events and the associated URLs. GET requests are sent to the specified URLs when specific event lifecycle steps are triggered.

Overrides:
See:
Example
event.trackingURLs = {
   [EVENTS.LAUNCH]: 'https://analyticsservice.com/pixel',
   [EVENTS.COMPLETE]: 'https://analyticsservice.com/pixel',
};

(readonly) type :OVERLAY_TYPE

The overlay type.

width :string

Overlay width. Use any valid CSS size like 300px or 100%

Default Value:
  • 33%