The JWP web player and associated code provide an array of core features to engage your viewers and monetize your content. But, you can extend these core features by using plugins.

By adding custom or third-party plugins within the setup configuration of a web player, you can produce unique user experiences:

  • Create custom user interactions

  • Initiate bespoke player behaviors

<br />

The following instructions explain only how to add plugins to the web player. Since JWP does not provide support for any third-party plugin or created plugins that you may add or create, we strongly recommend testing your implementation in a staging environment.

<br /> <hr />

## Add and register a plugin

A plugin becomes accessible in the `jwplayer().plugins` object only after it is registered.

<br />

Use the following steps to add and register a plugin:

  1. Within the options argument of `setup()`, add a `plugins` object that includes the URL of the plugin script to be added. When the player is instantiated, the plugin script is downloaded and initialized.<br /><br />As shown in the following example, multiple plugin scripts can be added to `plugins` as a comma-delimited list. Be sure to add any key-value pairs required by a plugin script.

<br />

  1. In the plugin script file, use `registerPlugin(pluginName, playerMinimumVersion, pluginClassOrFunction)` to attach the script to the player.

**pluginName** `string`Name of the plugin matching its filename<br /><br />**The** `pluginName` **must match the filename of the plugin.**
**playerMinimumVersion** `string`Minimum player version required the plugin
**pluginClassOrFunction** `class` | `function`Plugin function of class to instantiate with new player instances

<br /> <br />

Within the callback function assigned to `registerPlugin()`, the following three variables are also available:

  • **playerInstance**: Instance of the player API with which the plugin is being registered

  • **pluginConfig**: Config block passed in `player().setup()`

  • **pluginDiv**: DIV created in the DOM for this plugin<br />This DIV can be used or the DOM can be manipulated within the plugin code.

<br />

(Script tags will be stripped)