new module:vLite/Player(selector, options, callback)
Instanciate the constructor
Parameters:
| Name | Type | Description |
|---|---|---|
selector |
String | Object | CSS selector or query selector |
options |
Object | Player options |
callback |
function | Callback function executed when the player is ready |
Methods
(static) checkSupportFullScreen()
Check fullscreen support API on different browsers and cached prefixs
(static) formatVideoTime(time)
Convert video time second to 00:00 display
Parameters:
| Name | Type | Description |
|---|---|---|
time |
Float | Integer | Current time |
afterPlayPause()
Function executed after the play or pause method
bindEvents()
Create event listeners All listeners are created on class properties to facilitate the deletion of events
buildPlayer()
Build the DOM of the player
destroy()
Destroy the player Remove event listeners, player instance and player HTML
exitFullscreen()
Exit fullscreen after user action
fastForward(e)
Trigger the video fast forward (front and rear)
Parameters:
| Name | Type | Description |
|---|---|---|
e |
Object | Event listener datas |
isTouch() → {Boolean}
Check if browser support touch event
Returns:
Touch event support
- Type
- Boolean
loading(state)
Update the loader status
Parameters:
| Name | Type | Description |
|---|---|---|
state |
Boolean | Status of the loader |
mute()
Mute the volume on the video
onKeyup(e)
Function executed on keyup event listener Toggle the video on spacebar press
Parameters:
| Name | Type | Description |
|---|---|---|
e |
Object | Event listener datas |
onMousemove()
Function executed on mousemove event listener Toggle controls display on mousemove event
onVideoEnded()
Function executed when is video is ended
pause()
Pause the video
play()
Play the video
playerIsReady()
Function executed when the player is ready
requestFullscreen()
Request fullscreen after user action
seekTo(newTime)
Update the current time of the video
Parameters:
| Name | Type | Description |
|---|---|---|
newTime |
Float | Integer | New current time of the video |
toggleFullscreen()
Toggle the fullscreen of the video
togglePlayPause()
Function executed to toggle the video status (play, pause)
toggleVolume()
Toggle the volume on the video
unBindEvents()
Unbind event listeners
unMute()
Toggle the volume on the video
updateCurrentTime()
Update current time displaying in the control bar and the width of the progress bar
updateDuration()
Update player duration