Player options

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 usefull 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
}

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:

EntitlementEngine.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
}

Selecting a playback technology

When creating a new player, it's important to be aware of the fact that some systems do not support the latest technology.
The techOrder option of the player solves this problem. It can take an ordered array of technologies and test each for playback until a compatible player is found. You can supply only one entry in the array but this will force the playback technology and, consequently, that technology may not work on the respective system. Therefore, it is highly recommended to create an array with several technologies.
Available options are:

  • EmpShaka
  • EmpHLS
  • EmpFlash
  • Chromecast

When not set, the default value is ['EmpShaka', 'EmpHLS', 'EmpFlash', 'Chromecast']

Example:

options['techOrder'] = ['EmpDash', 'EmpFlash'];
new empPlayer('player', options, function () { /* ... */} );

Prefered audio / subtitle languages

When the playback starts, audio and subtitle languages are selected using the following rule:

  1. Language set in player options
  2. Document language (lang attribute on html tag)
  3. Browser preferred language
  4. Tech default (None for subtitles)

The following player options can be used to set the user preferences:

options['audioLanguage'] = session.preferences['audioLang'];
options['subtitleLanguage'] = session.preferences['subtitlesLang'];

The HTML5 reference application demonstrate how to use the preferences endpoint from EMP Exposure API to store/retrieve
user preferences.

Error messages translation

EmpPlayer uses VideoJS localization features. For more information see VideoJS documentation
Custom language dictionaries can be added using the languages option:

options.languages = {
  'fr' : {
    'No valid entitlement found for asset': 'Vous ne disposez pas de droits suffisants pour lire cette vidéo.',
    'The session token is not valid.': "Votre session n'est plus valide."
  }
};

Controls

EMP Player has a set of default controls. These can be disabled or have their behavior changed by overriding the controlBar option before initializing the player.
The available controls are:

  • playToggle
  • empRewindButton
  • empForwardButton
  • volumeMenuButton
  • currentTimeDisplay
  • timeDivider
  • durationDisplay
  • empLiveDisplay
  • progressControl
    • seekBar
      • loadProgressBar
      • empMouseTimeDisplay
      • playProgressBar
  • empTimeDisplay
  • customControlSpacer
  • empRestartButton
  • playbackRateMenuButton
  • chaptersButton
  • bitrateButton
  • audioTrackButton
  • subtitlesButton
  • captionsButton
  • chromeCastButton
  • fullscreenToggle

How to disable a control

The control option should be set to false before initializing the player:

options['controlBar'] = {
  'empForwardButton': false,
};

How to display a vertical volume slider

By default, EMP Player will display an horizontal volume slider, which appears when the mouse is hovers above the volume button. If, however, you prefer a vertical menu, you can do so by setting the following options before initializing the player:

options['controlBar'] = {
  'volumeMenuButton': {
    'inline': false,
    'vertical': true
  }
};

How to change the timer behaviour

By default, EMP Player will display a countdown timer next to the progress bar with the time remaining until the end of the asset (or the live edge when watching a live stream). If, however, you want to display the current time (when playing a live stream), you can change empTimeDisplay control behavior by using the mode option, and setting it to currentTime.

options['controlBar'] = {
  'empTimeDisplay': {
    'mode': 'currentTime'
  }
};

Other playback options

Timeshift can be disabled using options['timeShiftDisabled'] = true. When set to true, the scrub bar will not be displayed and the user will only be allowed to watch the live stream from it's current position.
If options['autoplay'] = true, the asset playback will automatically start when it is loaded.