The debug
plugin displays some overlays on top of the video.
Among other things, it’ll display the player version, playback engine, measured bandwidth and chosen representation.
This plugin will initialize itself automatically if debug
querystring param exists in URL.
The value of the debug
querystring will determine which tab is initially displayed (see defaultTab).
- Table of Contents
- Init Options
- Properties
- versionpro
- Methods
Init Options
options : object
Initialization options for the debug plugin.
- options :
object
- .defaultTab :
string
- .extra :
string
- .visible :
boolean
- .defaultTab :
options.defaultTab : string
The default tab which will be initially displayed.
You can also set this via the debug
querystring’s value.
Default: "player"
See: switchTab
Example
// playerOptions.json
{
"plugins": {
"debug": {
"defaultTab": "consolay"
}
}
}
options.extra : string
An extra string to be displayed on the top right hand corner.
Default: "null"
See: setExtra
Example
// playerOptions.json
{
"plugins": {
"debug": {
"extra": "MyApp v1.2.3"
}
}
}
options.visible : boolean
The initial visibility of the debug plugin.
Default: true
See: toggle
Example
// playerOptions.json
{
"plugins": {
"debug": {
"visible": false
}
}
}
Properties
player.debug.version : string
The debug plugin’s version string.
Example
console.log('The debug plugin version is', player.debug.version);
Methods
player.debug.addTab(name, contents, [options])
Add another tab to the debug plugin.
Param | Type | Description |
---|---|---|
name | string |
The tab’s name. |
contents | Element | string |
The contents of the tab. Could be a DOM element or a string which will become the innerHTML of an element. |
[options] | object |
An options object. |
[options.title] | string |
The title of the tab. |
Example
// Wait for debug plugin to be initialized before adding our tab
player.pluginInited('debug').then(() => {
player.debug.addTab('mytab', myContentDiv, { title: 'MyTab' });
});
player.debug.getTabContents(name) ⇒ Element
Get a reference to a tab contents DOM element.
Returns: Element
- The tab contents DOM element.
Param | Type | Description |
---|---|---|
name | string |
The tab’s name. |
Example
var myContentDiv = player.debug.getTabContents('mytab');
player.debug.switchTab(name)
Switch to another tab.
Param | Type | Description |
---|---|---|
name | string |
The tab’s name. Special values ‘next’ and ‘prev’ are also supported. |
Example
player.debug.switchTab('player');
player.debug.setExtra(label)
Set a string label on the bottom right hand corner.
Each call will override previous label.
Param | Type | Description |
---|---|---|
label | string |
A string to be displayed on the bottom right hand corner. |
Example
player.debug.setExtra('MyApp v1.2.3');
player.debug.toggle()
Toggle the visibility of debug overlays.
Pressing the ~
key will invoke this function.
Example
player.debug.toggle();