API Reference

This page documents all methods available on the nexx360InstreamPlayer object (exposed as window.nexx360InstreamPlayer).

Methods Overview

Method
Description

Initialize the player with configuration and start viewport observation

Tear down the player and clean up resources

Subscribe to a player event

Unsubscribe from a player event

Get the library version

Get the library build date


init()

Initializes the instream player with your configuration. The player immediately starts observing the container element — when 50% of it enters the viewport, the ad request is sent and playback begins automatically.

Syntax

nexx360InstreamPlayer.init(config)

Parameters

config (required)

Property
Required
Type
Default
Description

tagId

Yes

string

Nexx360 tagId for the ad unit

container

Yes

HTMLElement | string

Container element or its DOM ID

width

No

number

640

Player width in pixels

height

No

number

480

Player height in pixels

autoplay

No

boolean

true

Auto-play when entering viewport

mute

No

boolean

true

Start muted (required for browser autoplay)

minDuration

No

number

Minimum ad duration in seconds

maxDuration

No

number

Maximum ad duration in seconds

startdelay

No

number

OpenRTB start delay value

gdpr

No

string

GDPR applies flag ('1' or '0')

gdprConsent

No

string

TCF v2 consent string

usPrivacy

No

string

US Privacy string (e.g. '1YNN')

test

No

boolean

false

Enable test mode in bid requests

bidTimeout

No

number

3000

Auction timeout in milliseconds

circle-info

Most browsers block unmuted autoplay. When autoplay is true (default), the mute option should also be true to ensure reliable playback without user interaction.

Autoplay & Mute — OpenRTB Mapping

The autoplay and mute parameters control the OpenRTB playbackmethod value sent in the bid request:

autoplay
mute
playbackmethod
Description

true (default)

true (default)

6

Initiates on Entering Viewport with Sound Off

true

false

5

Initiates on Entering Viewport with Sound On

false

any

3

Initiates on Click with Sound On

Example

TypeScript Definition


destroy()

Tears down the player: stops viewport observation, destroys the IMA SDK instances, removes DOM elements, and emits the destroyed event.

Syntax

Example


on()

Subscribes to a player event.

Syntax

Parameters

Parameter
Type
Description

event

string

Event name (see Events table)

callback

function

Handler function, receives optional event data

Example


off()

Unsubscribes from a player event.

Syntax

Parameters

Parameter
Type
Description

event

string

Event name

callback

function

The same function reference passed to on()

Example


getVersion()

Returns the library version string (set at build time from the release tag).


getBuildDate()

Returns the library build date as an ISO string.


Events

All events can be subscribed to using on() and unsubscribed from using off().

Event
Description
Data

loaded

Ad creative has been loaded by IMA

started

Ad playback has started

firstQuartile

Ad reached 25% completion

midpoint

Ad reached 50% completion

thirdQuartile

Ad reached 75% completion

complete

Ad playback completed (100%)

allAdsCompleted

All ads in the pod have completed

click

User clicked the ad

paused

Ad was paused (e.g. scrolled out of viewport)

resumed

Ad was resumed (e.g. scrolled back into viewport)

skipped

User skipped the ad

error

An error occurred

{ message: string, code: number }

destroyed

Player was destroyed via destroy()

Example: Tracking All Events


Full Integration Example

Last updated

Was this helpful?