Projekktor plug-ins are (optional) components extending the basic player´s functionality, behavior and / or look. They can be applied to one, more or all player instances and at any time during player instantiation. All Projekktor plug-ins consist of at least one Javascript file and sometimes an additional CSS featuring a basic demo-style. Some plug-ins require additional HTML markup either within the page or the player itself.
Plugins have unique, single word names, e.g. “share”, “related”. The plugin files are named accordingly following this namescheme: projekktor.<plugin name>.<extention>, e.g. “projekktor.share.js”, “projekktor.share.css” etc. pp.
To activate a plugin all *.JS and *.CSS files coming with the plugin-archive must be correctly included into the page in question and possibly required HTML markups must be copy and pasted from an existing projekktor.<pluginname>.html - file into the player´s DOM or the page´s body.
Additionally the player has to learn which plugin(s) should be fired with events. To do so the plugin´s name must be added to the “addplugins”-config array, e.g. to activate the “related” plugin you hack :
var player = projekktor('#player_a', {
controls: true,
autoplay: false,
addplugins: ['related'],
playlist: [
{
0: {src:'demovideo.mp4', type:"video/mp4"},
}
]
});
The plugin´s name is also relevant to address plugin specific configuration. Once a plugin has been added via “addplugins” the player eats additional config-objects named by the plugin and prefixed with “plugin_”. E.g. below, note the “plugin_related” object (on player level configuration):
var player = projekktor('#player_a', {
controls: true,
autoplay: false,
addplugins: ['related'],
playlist: [
{
0: {src:'http://www.projekktor.com/video/mc.mp4', type:"video/mp4"},
}
],
plugin_related: {
related: {
enabled: true,
title: 'Related Videos',
items: [
{poster: './videoposter1.jpg', url: 'http://www.yoursite.com/vid1', title:'Title 1'},
{poster: './videoposter2.jpg', url: 'http://www.yoursite.com/vid2', title:'Title 2'},
{poster: './videoposter3.jpg', url: 'http://www.yoursite.com/vid3', title:'Title 3'}
]
}
}
});
Please note that some plugins must be configured on item-level why most are configured on player level.