new Player(element, optionsopt)
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
element |
jQuery
|
Element when player will init | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object
|
<optional> |
|
Extends
- Component
Members
(static) registerComponent
Register component
- Source:
Example
Player.registerComponent('ErrorDisplay', ErrorDisplay);
(static) registerControl
Get by name registered control
- Source:
Example
Player.registerControl('backward', BackwardControl);
Player#currentTime :Nubmer
Get and set the current playback position in the audio/video (in seconds)
Getter and setter
- Source:
Type:
-
Nubmer
Player#duration :Nubmer
Returns the length of the current audio/video (in seconds)
Getter
- Source:
Type:
-
Nubmer
Player#ended :Boolean
Returns whether the playback of the audio/video has ended or not
Getter
- Source:
Type:
-
Boolean
Player#error :MediaError|String
Returns and set whether the playback of the audio/video has ended or not
Getter and setter
- Source:
Type:
-
MediaError|String
Fires:
Player#height :Number
Return the height of player. If you want get height only of video element, use this.video.height or whatever
- Source:
Type:
-
Number
Player#videoHeight :Number
Return unnecessary video heigth
- Source:
Type:
-
Number
Player#view :String
Set and get player view. View Can be 'common', 'fullscreen', 'mini'w
- Source:
Type:
-
String
this.errorDisplay :ErrorDisplay
Error display component.
- Source:
Type:
-
ErrorDisplay
this.innerElement :jQuery
DOM container to hold inner of player
- Source:
Type:
-
jQuery
Methods
(static) plugin(name, fn)
Static helper for creating a plugins for leplayer
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String
|
The name of plugin |
fn |
function
|
Plugin init function |
Example
Player.plugin('helloWorld', function(pluginOptions) {
const player = this;
player.on('click', () => console.log('Hello world'));
})
(static) preset(name, fn)
Static helper for creating a plugins for leplayer
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String
|
The name of plugin |
fn |
function
|
Object
|
Plugin init function |
Example
Player.preset('common', {
width : '100%',
plugins : {
miniplayer : true
}
});
changeQuality(quality)
Change source and save time, rate
- Source:
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
quality |
Object
|
|
createElement()
Remove unnecessary attributes, and set some attrs from options (loop, poster etc...). Create main DOM objects
- Source:
exitFullscreen()
Exit fullscreen
- Source:
Fires:
getControls(name) → {ControlCollection}
Get ControlCollection of Player by name (e.x 'common', 'fullscreen')
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String
|
Name of ControlCollection |
Returns:
- Type:
-
ControlCollection
getData() → {jQuery.promise}
Get some data for player
- Source:
Returns:
- Type:
-
jQuery.promise
Promise
getWidth() → {Number}
Return the width of player.
- Source:
Returns:
- Type:
-
Number
Width in px
onDelView(view) → {Player}
On del view callback
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
view |
String
|
View name |
Example
const player = new Player($('#video'), options);
player.onDelView('mini', () => console.log('Exit miniplayer')
onSetView(view) → {Player}
On set view callback
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
view |
String
|
View name |
Example
const player = new Player($('#video'), options);
player.onSetView('mini', () => console.log('Miniplayer yeah!')
.onSetView('fullscreen', () => console.log('Fullscreen boom!')
.onSetView('common', () => console.log('Common view - lol');
play()
Starts playing the video
- Source:
Example
const player = new Player($("#video"),options);
$('.some-button').on('click', () => player.play());
requestFullscreen()
Request fullscreen
- Source:
Fires:
toggleFullscreen()
Toggle fullscreen
- Source:
Fires:
Events
error
error event
Properties:
| Name | Type | Description |
|---|---|---|
error |
MediaError
|
- Source:
Example
const player = new Player($('#video'), options);
player.on('error', (e, data) => console.error(data.error));
sectionsinit
Sections init event
- Source:
Example
const player = new Player($('#video'), options);
player.on('sectionsinit', (e, data) => cosnole.log(data));