Class: EntitlementEngine

EntitlementEngine


new EntitlementEngine( [options])

EntitlementEngine Class

Parameters:
Name Type Argument Description
options Object <optional>

Object of option names and values

Methods


<static> getEntitlementEngine(name)

Get an entitlement engine by name

Parameters:
Name Type Description
name string

Name of the entitlement engine

Returns:

EntitlementEngine

Type
EntitlementEngine

<static> isEntitlementEngine(object)

Return whether the past argument is an entitlement engine or not

Parameters:
Name Type Description
object Object

An item to check

Returns:

Wheter it is a entitlement engine or not

Type
boolean

<static> registerEntitlementEngine(name, entitlementEngine)

Register an entitlement engine

Parameters:
Name Type Description
name string

Name of the entitlement engine

entitlementEngine EntitlementEngine

The entitlement engine to register

Throws:

Error

Returns:

EntitlementEngine

Type
EntitlementEngine

fetchPreferences(callback)

Fetch user Preferences

Parameters:
Name Type Description
callback function

getAssetInfo(assetId, callback)

Get the Asset Info

Parameters:
Name Type Description
assetId string
callback function

getCachedServerTime()

getCachedServerTime

Returns:

getCachedServerTime

Type
number

getChannelInfo(channelId, callback)

get ChannelInfo

Parameters:
Name Type Description
channelId string

Channel to fetch from

callback function

Callback when entitlement is fetched


getEntitlement(entitlementRequest, playRequest, callback)

Get Entitlement

Called by the player to get an entitlement. Entitlement requests contain an assetId and an optional programId.
If the programId exists, the assetId is the channelId. if the programId doesn't exist the assetId is the assetId.

The callback should be called when the requests completes, if it fails it should contain an EntitlementError
Exception object as it's second parameter.

if it succeeds it should return the Entitlement as the first parameter.

The Entitlement should contain the following parameters:

playToken - Playtoken required for drm
mediaLocator - URL of playlist file

Parameters:
Name Type Description
entitlementRequest EntitlementRequest

Entitlement request to execute

playRequest Object

Playrequest object containing information about the required
attributes of the entitlement (e.g. { drm: 'EDRM', 'format': 'HLS' }

callback function

Callback when entitlement is fetched or an error occurs


getEPG(channelId, from, to, callback)

Get EPG

Parameters:
Name Type Description
channelId string
from string
to string
callback function

getNextProgram(programId, callback)

Get next program

Parameters:
Name Type Description
programId string
callback function

getPreferences(callback)

Get user preferences key/value pair of (audioLang, subtitlesLang)

Parameters:
Name Type Description
callback EntitlementEngine~getPreferences

Callback with user Preferences


getPreviousProgram(programId, callback)

Get previous program

Parameters:
Name Type Description
programId string
callback function

getProgramInfo(channelId, date, callback, programId)

Get the program based on EPG

Parameters:
Name Type Description
channelId string
date Date
callback function
programId string

getServerTime(callback)

Returns the exact servertime

Parameters:
Name Type Description
callback EntitlementEngine~getServerTimeCallback

Callback when server time is fetched or an error occurs


getV2Entitlement(entitlementRequest, playRequest, callback, preEntitlement)

Get Entitlement version 2

Called by the player to get an entitlement. Entitlement requests contain an assetId and an optional programId.
If the programId exists, the assetId is the channelId. if the programId doesn't exist the assetId is the assetId.

The callback should be called when the requests completes, if it fails it should contain an EntitlementError
Exception object as it's second parameter.

if it succeeds it should return the Entitlement as the first parameter.

The Entitlement should contain the following parameters:

playToken - Playtoken required for drm
mediaLocator - URL of playlist file

Parameters:
Name Type Description
entitlementRequest EntitlementRequest

Entitlement request to execute

playRequest Object

Playrequest object containing information about the required
attributes of the entitlement (e.g. { drm: 'EDRM', 'format': 'HLS' }

callback function

Callback when entitlement is fetched or an error occurs

preEntitlement Entitlement

Previous Entitlement after error


login(username, password, callback, mfacode)

Login

Parameters:
Name Type Description
username string
password string
callback function
mfacode string

logout(callBack)

logout

Parameters:
Name Type Description
callBack function

savePreferences(preferences, callback)

Save user preferences (audioLang, subtitlesLang)

Parameters:
Name Type Description
preferences any

key/value pair of (audioLang, subtitlesLang)

callback function

savePreferences(preferences, callback)

Save user preferences

Parameters:
Name Type Description
preferences Object
callback function

syncServerTime(callback)

Sync localtime with servertime

Parameters:
Name Type Description
callback EntitlementEngine~getServerTimeCallback

Callback when localtime sync with servertime or an error occurs


verifyEntitlement(assetId, playRequest, callback)

verify the entitlement

Parameters:
Name Type Description
assetId string
playRequest Object
callback function

verifySession(okFn, nokFn)

Verifies if sessionToken is still valid

Parameters:
Name Type Description
okFn function

callback if session is ok

nokFn function

callback if session is not ok

Type Definitions


getServerTimeCallback(date, error)

This callback is called by getServerTime when current time is fetched from the server or an error occured

Parameters:
Name Type Description
date Date

Current server time

error string

Error description

Class: EntitlementEngine

EntitlementEngine


new EntitlementEngine( [options])

Create EntitlementEngine

Parameters:
Name Type Argument Description
options Object <optional>

Object of option names and values

Methods


<static> getEntitlementEngine(name)

Get an entitlement engine by name

Parameters:
Name Type Description
name string

Name of the entitlement engine

Returns:

EntitlementEngine

Type
EntitlementEngine

<static> isEntitlementEngine(object)

Return whether the past argument is an entitlement engine or not

Parameters:
Name Type Description
object Object

An item to check

Returns:

Wheter it is a entitlement engine or not

Type
boolean

<static> registerEntitlementEngine(name, entitlementEngine)

Register an entitlement engine

Parameters:
Name Type Description
name string

Name of the entitlement engine

entitlementEngine EntitlementEngine

The entitlement engine to register

Throws:

Error

Returns:

EntitlementEngine

Type
EntitlementEngine

fetchPreferences(callback)

Fetch user Preferences

Parameters:
Name Type Description
callback function

getAssetInfo(assetId, callback)

Get the Asset Info

Parameters:
Name Type Description
assetId string
callback function

getCachedServerTime()

getCachedServerTime

Returns:

getCachedServerTime

Type
number

getChannelInfo(channelId, callback)

get ChannelInfo

Parameters:
Name Type Description
channelId string

Channel to fetch from

callback function

Callback when entitlement is fetched


getEntitlement(entitlementRequest, playRequest, callback)

Get Entitlement

Called by the player to get an entitlement. Entitlement requests contain an assetId and an optional programId.
If the programId exists, the assetId is the channelId. if the programId doesn't exist the assetId is the assetId.

The callback should be called when the requests completes, if it fails it should contain an EntitlementError
Exception object as it's second parameter.

if it succeeds it should return the Entitlement as the first parameter.

The Entitlement should contain the following parameters:

playToken - Playtoken required for drm
mediaLocator - URL of playlist file

Parameters:
Name Type Description
entitlementRequest EntitlementRequest

Entitlement request to execute

playRequest Object

Playrequest object containing information about the required
attributes of the entitlement (e.g. { drm: 'EDRM', 'format': 'HLS' }

callback function

Callback when entitlement is fetched or an error occurs


getEPG(channelId, from, to, callback)

Get EPG

Parameters:
Name Type Description
channelId string
from string
to string
callback function

getNextProgram(programId, callback)

Get next program

Parameters:
Name Type Description
programId string
callback function

getPreferences(callback)

Get user preferences key/value pair of (audioLang, subtitlesLang)

Parameters:
Name Type Description
callback EntitlementEngine~getPreferences

Callback with user Preferences


getPreviousProgram(programId, callback)

Get previous program

Parameters:
Name Type Description
programId string
callback function

getProgramInfo(channelId, date, callback, programId)

Get the program based on EPG

Parameters:
Name Type Description
channelId string
date Date
callback function
programId string

getServerTime(callback)

Returns the exact servertime

Parameters:
Name Type Description
callback EntitlementEngine~getServerTimeCallback

Callback when server time is fetched or an error occurs


getV2Entitlement(entitlementRequest, playRequest, callback, preEntitlement)

Get Entitlement version 2

Called by the player to get an entitlement. Entitlement requests contain an assetId and an optional programId.
If the programId exists, the assetId is the channelId. if the programId doesn't exist the assetId is the assetId.

The callback should be called when the requests completes, if it fails it should contain an EntitlementError
Exception object as it's second parameter.

if it succeeds it should return the Entitlement as the first parameter.

The Entitlement should contain the following parameters:

playToken - Playtoken required for drm
mediaLocator - URL of playlist file

Parameters:
Name Type Description
entitlementRequest EntitlementRequest

Entitlement request to execute

playRequest Object

Playrequest object containing information about the required
attributes of the entitlement (e.g. { drm: 'EDRM', 'format': 'HLS' }

callback function

Callback when entitlement is fetched or an error occurs

preEntitlement Entitlement

Previous Entitlement after error


login(username, password, callback, mfacode)

Login

Parameters:
Name Type Description
username string
password string
callback function
mfacode string

logout(callBack)

logout

Parameters:
Name Type Description
callBack function

savePreferences(preferences, callback)

Save user preferences (audioLang, subtitlesLang)

Parameters:
Name Type Description
preferences any

key/value pair of (audioLang, subtitlesLang)

callback function

savePreferences(preferences, callback)

Save user preferences

Parameters:
Name Type Description
preferences Object
callback function

syncServerTime(callback)

Sync localtime with servertime

Parameters:
Name Type Description
callback EntitlementEngine~getServerTimeCallback

Callback when localtime sync with servertime or an error occurs


verifyEntitlement(assetId, playRequest, callback)

verify the entitlement

Parameters:
Name Type Description
assetId string
playRequest Object
callback function

verifySession(okFn, nokFn)

Verifies if sessionToken is still valid

Parameters:
Name Type Description
okFn function

callback if session is ok

nokFn function

callback if session is not ok

Type Definitions


getServerTimeCallback(date, error)

This callback is called by getServerTime when current time is fetched from the server or an error occured

Parameters:
Name Type Description
date Date

Current server time

error string

Error description