Entitlement

Setting an entitlement connector

When asked to play an asset, the player will call getEntitlement() function from the exposure object set in the entitlement-engine option:

var options = {
    'entitlement-engine': 'EricssonExposure'
}

EricssonExposure is the default entitlement engine, it will be used if no other engine is set. It is designed to be used with Ericsson Exposure API.
Once the player has been created, the current entitlement engine can be accessed through player.entitlementEngine.
This can be useful to update configuration values (for example if you want to refresh the session token).

EricssonExposure options

The following configuration options are required:

var exposureOptions = {
    'customer': customer,
    'businessUnit': businessUnit,
    'sessionToken': sessionToken,
    'exposureApiURL': apiUrl
  };

They are passed to the player using the ericssonexposure option:

var options = {
    'ericssonexposure': exposureOptions
}

Working with EricssonExposure

To get a reference to ericssonExposure call empPlayer.getExposure(exposure options)

var options = {
     'ericssonexposure': {
        'customer': 'TestGroup',
        'businessUnit': 'Test',
        'exposureApiURL': 'https://test.ebsd.ericsson.net'
    },
}
var exposure = empPlayer.getExposure(options.ericssonexposure);

With exposure object you can.

All method's on EricssonExposure

Creating a custom entitlement connector

You can create your own entitlement engine connector by extending EntitlementEngine base class.
To do this, you first need to get a reference to the base class by using empPlayer.getEntitlementEngine():

var EntitlementEngine = empPlayer.getEntitlementEngine('EntitlementEngine');

Once you have that, you can write your own entitlement engine implementation:

var MyEntitlementClass = empPlayer.extend(EntitlementEngine, {
  constructor: function(options) {
    // passed in trough player 'myentitlementclass' options
  },
  getEntitlement: function(entitlementRequest, playRequest, callback) {
  }
});

Once it is done, and before the player can use it, it should be registered using:

empPlayer.registerEntitlementEngine('MyEntitlementClass', MyEntitlementClass);

When a new instance of the player is created and MyEntitlementClass is used as entitlement-engine option, it will use your own object and pass the option parameter called myentitlementclass (class name, lower case):

var options = {
    'entitlement-engine': 'MyEntitlementClass'
    'myEntitlementclass': MyEntitlementClassOptions
}