Overriding Player Options

As part of the loading sequence of a project, a new instance of InterludePlayer is created, by calling new Interlude Player, and passing it configuration options. While this initialization is handled by Eko, in some scenarios you might want to override the player’s or a certain plugin’s default options. For example, you may want to use the canvas plugin in your project, or say you want to disable the default checkpoint creation for each decision in the project.

In order to override the playerOptions you need to have a project checked out on your machine. If this isn’t the case you should probably perform the checkout tutorial first.

To override options add your options in the playerOptions.json file which resides in src/config.
Any options you specify in this file will be merged with the other options passed to the player by Eko’s platform. Your options take precedence over the platform defaults, but could be overridden by the options specified in Eko’s CMS.

The playerOptions object has two main functions:

Player Options

This is done by adding properties at the root level of the playerOptions object. For example, if we want to change the scaling in the player from the default panAndScan, our options would look like this:

{
    scaling: 'boxing'
}

There are other properties that can be overriden like this which you can read about in the player API page.

Plugins Options

This is done by adding properties under the plugins property (which is a root property). For example, let’s say that in addition to changing the scaling like we did above, we want to always initialize the debug plugin. In that case we would add the debug property to plugins like so:

{
    scaling: 'boxing',
    plugins: {
        debug: true
    }
}

The debug property receives the value true which is a way to tell the player that we want to initialize the debug plugin but we don’t have any specific options to give it. If we wanted in addition to change the default tab of the plugin, we would edit the options like so:

{
    scaling: 'boxing',
    plugins: {
        debug: {
            defaultTab: 'playerOptions'
        }
    }
}

In the documentation for each plugin you can find the different options that can be used for configuring that plugin.

In some cases, it’s useful to have visibility to what playerOptions were passed to the player upon initialization. You can do this by opening the playerOptions tab when viewing the project in Debug Mode.

Rate this page: X
Tell us more!