Plugins¶
PRESTOplay for web ships with a solid set of built-in plugins that extend the player or integrate it with third-party services such as analytics and advertising. When you need to go further, the plugin system also lets you extend and customize the SDK yourself.
Built-in plugins¶
Each plugin ships as a separate module and must be imported before creating the player to register it.
Plugin |
Use |
|---|---|
Reports playback metrics to Adobe Analytics via the |
|
Casts to AirPlay receivers. See AirPlay. |
|
Broadpeak server-side ad insertion and analytics. See Analytics. |
|
Reports playback metrics to Conviva Experience Insights. See Analytics. |
|
FreeWheel ad insertion. See Advertising. |
|
Processes SMPTE-TT image cues in HLS streams. See Subtitles. |
|
Google Interactive Media Ads (IMA) SDK integration. See Advertising. |
|
Reports playback metrics to Mux Data. See Analytics. |
|
MediaTailor |
AWS Elemental MediaTailor server-side ad insertion. |
Reports playback metrics to NPAW (Youbora). See Analytics. |
|
Sequential playback of multiple media items. See Playlist. |
|
SIMID |
Secure Interactive Media Interface Definition (SIMID) support for interactive ad creatives. |
Loads and parses thumbnail previews. See Thumbnails. |
|
Vimond integration. Deprecated — will be removed in a future major version. |
|
Adds 360-degree video playback support. |
|
Yospace server-side ad insertion. See Advertising. |
Writing a custom plugin¶
PRESTOplay plugins are class-based components that implement the
PlayerPlugin interface. The interface defines a set of callbacks
and hooks that the player calls at different points during its lifecycle.
The player calls these callbacks on each plugin instance:
Callback |
Called |
|---|---|
|
When the |
|
Before content loads. Register event listeners here. Return a URL, or a promise that resolves with one, to replace the stream URL. If a promise is returned, loading waits for it. |
|
After content loads. Content information such as |
|
Before the current content is released, including before each new |
|
Before the player is destroyed. Clean up everything else. |
|
Returns the plugin ID. The plugin instance is then available through |
The custom plugin sample implements every callback in a plugin that renders a stats overlay on top of the video and shows when each callback runs.
Registering a plugin¶
Register the plugin with the SDK before using it. The SDK exposes a plugin
factory PlayerPluginFactory interface that you implement and
provide.
A generic plugin factory that creates instances of a MyPlugin class looks
like this:
/**
* @implements {clpp.PlayerPluginFactory}
*/
class MyPluginFactory {
/**
* @override
*/
create (playerConfig) {
return new MyPlugin();
}
};
Register the factory with the player using Player.registerPlugin:
// *Before* the player instance is created
clpp.Player.registerPlugin(new MyPluginFactory());
// ...
// Now the plugin will be used with each new instance of the player.
const player = new clpp.Player(...);