new ExperienceSdk()

Description

Creates an instance of ExperienceSdk.

Methods


<async, static> init( config ) → {Promise}

Description

Initializes ExperienceSdk
Important: Needs to be called before preLoad and start!
When done, emits EventTypes.initDone
If config.autoPreLoad is true, calls preLoad method
If config.autoStart is true, calls start method

Parameters
Name Type Description
config Object

config for initialization.

Name Type Description
accountHash string

The account hash to identify clients' account.

autoPreLoad boolean

The setting to define if related packages/assets will be preloaded with init
method or separately with calling preLoad() method.

autoStart boolean

The setting to define if feature tracking will start automatically after sdk
initialized and media stream accessed.

features Array.<(Object|ClassifiersRawDataFeatureConfig)>

Array of configurations for features
to calculate with experience SDK.

Returns
Details

getting-started


<async, static> preLoad() → {Promise}

Description

Starts the preloading of needed assets, codes, which may take longer.
Emits EventTypes.initDone if finished.
Important: init method needs to be called before!

Returns

<async, static> start() → {Promise}

Description

Starts prediction, if preLoad method haven't called yet, it will call it first.
Important: init method needs to be called before!

Returns

<async, static> stop( releaseCamera ) → {Promise}

Description

Stops all the trackers and features. Releases the camera if not recieved through config.

Cannot restart tracking if camera is released.

Parameters
Name Type Description
releaseCamera bool

Force release camera stream. If the camera stream is released,
the sdk cannot be restarted!

Returns

<async, static> error( callback ) → {Promise}

Description

Calls the callback function with the occurred error object.

Parameters
Name Type Description
callback *

Client's callback function

Returns

<async, static> on( eventName, callback ) → {Promise}

Parameters
Name Type Description
eventName string

Client's callback function

callback eventCallback

Client's callback function

Returns

<async, static> off( eventName, listener ) → {Promise}

Description

Unsubscribe from an event by it's name and the listener

Parameters
Name Type Description
eventName string

Name of the event to unsubscribe from

listener object

Event listener which was subscribed on event

Returns

<async, static> offAll( eventName ) → {Promise}

Description

Unsubscribe from an event for all the listener

Parameters
Name Type Description
eventName string

Name of the event to unsubscribe from

Returns

<static> getRunningState() → {string}

Description

Gets the ExperienceSDK's running state, which can be:
NotInitialized, Idle, Running, Error

Returns

<static> markIntervalStart( intervalType, contentId, intervalStart, timeoutSeconds ) → {void}

Description

Marks the start of a special interval.

Parameters
Name Type Description
intervalType string

Custom string to identify the what the marked interval represents.
E.g. it can be "ad" or "content_video".
At most one interval of a given type can be open at any given point in time.

contentId string

A domain specific custom identifier of the content of the marked interval.

intervalStart timestamp

This parameter can be used for marking intervals
that actually started before the method call.
If you do not specify it, the ExperienceSDK will use the current time as the timestamp.

timeoutSeconds int

Number of seconds after which the interval
will automatically be considered closed by the backend,
even if no ending signal is received.

Returns

<static> markIntervalEnd( intervalType, intervalEnd ) → {void}

Description

Marks the end of a started interval.

Parameters
Name Type Description
intervalType string

Custom string to identify the what the marked interval represents.
E.g. it can be "ad" or "content_video".
At most one interval of a given type can be open at any given point in time.

intervalEnd timestamp

This parameter can be used for marking intervals
that actually started before the method call.
If you do not specify it, the ExperienceSDK will use the current time as the timestamp.

Returns

<static> setIntervalInfoString( intervalType, key, value ) → {void}

Description

Sends a custom string meta-data property for the given interval.

Parameters
Name Type Description
intervalType string

The interval type to which the property will be assigned.

key string

The key of the property.

value string

The value of the property.

Returns

<static> setIntervalInfoBoolean( intervalType, key, value ) → {void}

Description

Sends a custom string meta-data property for the given interval.

Parameters
Name Type Description
intervalType string

The interval type to which the property will be assigned.

key string

The key of the property.

value bool

The value of the property.

Returns

<static> setIntervalInfoNumber( intervalType, key, value ) → {void}

Description

Sends a custom string meta-data property for the given interval.

Parameters
Name Type Description
intervalType string

The interval type to which the property will be assigned.

key string

The key of the property.

value number

The value of the property.

Returns

<static> getSourceId() → {string}

Description

Gets participantId

Returns

<static> deleteSourceData() → {void}

Description

Deletes all data stored on the client side.

Returns

<static> addCustomProperty( key, value ) → {void}

Description

Adds a custom string property to the custom property map of all subsequent events.

Parameters
Name Type Description
key string

The key of the property.

value *

The value of the property.

Returns

<static> getCustomProperties() → {object}

Description

Return key-value pairs of custom properties.

Returns

Key-value pairs.


<static> setSourceAttributeString( key, value ) → {void}

Description

Sends a custom string meta-data property for the source.

Parameters
Name Type Description
key string

The key of the property.

value string

The value of the property.

Returns

<static> setSourceAttributeNumber( key, value ) → {void}

Description

Sends a custom string meta-data property for the source.

Parameters
Name Type Description
key string

The key of the property.

value number

The value of the property.

Returns

<static> setSourceAttributeBoolean( key, value ) → {void}

Description

Sends a custom string meta-data property for the source

Parameters
Name Type Description
key string

The key of the property.

value bool

The value of the property.

Returns

Type Definitions


eventCallback( args )

Parameters
Name Type Description
args Object

event's arguments

Details
function