- new Player(tag, optionsopt, readyopt)
- Extends
- Members
- Methods
- static getTagSettings(tag) → {Object}
- $(selector, contextopt) → {Element|null}
- $$(selector, contextopt) → {NodeList}
- addChild(child, optionsopt, indexopt) → { Component }
- addClass(classToAdd)
- addRemoteTextTrack(options, manualCleanupopt) → {HtmlTrackElement}
- addTextTrack(kindopt, labelopt, languageopt) → { TextTrack |undefined}
- aspectRatio(ratioopt) → {string|undefined}
- audioTracks() → { AudioTrackList }
- autoplay(valueopt) → {boolean|string}
- blur()
- breakpoints(breakpointsopt) → {Object}
- buffered() → {TimeRange}
- bufferedEnd() → {number}
- bufferedPercent() → {number}
- abstract buildCSSClass() → {string}
- cancelAnimationFrame(id) → {number}
- cancelNamedAnimationFrame(name)
- canPlayType(type) → {string}
- children() → {Array}
- clearInterval(intervalId) → {number}
- clearTimeout(timeoutId) → {number}
- contentEl() → {Element}
- controls(boolopt) → {boolean}
- createEl() → {Element}
- createModal(content, optionsopt) → { ModalDialog }
- crossOrigin(valueopt) → {string|undefined}
- currentBreakpoint() → {string}
- currentBreakpointClass() → {string}
- currentDimension(widthOrHeight) → {number}
- currentDimensions() → { Component~DimensionObject }
- currentHeight() → {number}
- currentSource() → { Tech~SourceObject }
- currentSources() → {Array.< Tech~SourceObject >}
- currentSrc() → {string}
- currentTime(secondsopt) → {number}
- currentType() → {string}
- currentWidth() → {number}
- debug(enabled)
- defaultMuted(defaultMutedopt) → {boolean| Player }
- defaultPlaybackRate(rateopt) → {number| Player }
- dimension(dimension, valueopt) → {number}
- dimensions(width, height)
- disablePictureInPicture(value)
- dispose()
- documentFullscreenChange_()
- duration(secondsopt) → {number}
- el() → {Element}
- enableTouchActivity()
- ended() → {Boolean}
- enterFullWindow()
- error(erropt) → { MediaError |null}
- exitFullscreen()
- exitFullWindow()
- exitPictureInPicture() → {Promise}
- fill(boolopt) → {boolean|undefined}
- flexNotSupported_() → {boolean}
- fluid(boolopt) → {boolean|undefined}
- focus()
- fullWindowOnEscKey(event)
- getAttribute(attribute) → {string|null}
- getCache() → {Object}
- getChild(name) → { Component |undefined}
- getChildById(id) → { Component |undefined}
- getDescendant(…names) → { Component |undefined}
- getMedia() → { Player~MediaObject }
- getVideoPlaybackQuality() → {Object|undefined}
- handleHotkeys(event)
- handleKeyDown(event)
- handleKeyPress(event)
- abstract handleLanguagechange()
- handleSrc_(sourceopt, isRetry) → {string|undefined}
- hasClass(classToCheck) → {boolean}
- hasPlugin(name) → {boolean}
- hasStarted(request) → {boolean}
- height(valueopt) → {number}
- hide()
- id() → {string}
- initChildren()
- isAudio(bool) → {boolean}
- isDisposed() → {boolean}
- isFullscreen(isFSopt) → {boolean}
- isInPictureInPicture(isPiPopt) → {boolean}
- language(codeopt) → {string}
- languages() → {Array}
- load()
- loadMedia(media, ready)
- localize(string, tokensopt, defaultValueopt) → {string}
- loop(valueopt) → {boolean}
- manualAutoplay_()
- muted(mutedopt) → {boolean}
- name() → {string}
- networkState() → {number}
- options(obj) → {Object}
- pause() → { Player }
- paused() → {boolean}
- play() → {Promise|undefined}
- playbackRate(rateopt) → {number}
- playbackRates(newRates) → {Array.<number>}
- played() → {TimeRange}
- player() → { Player }
- playsinline(valueopt) → {string| Player }
- poster(srcopt) → {string}
- preload(valueopt) → {string}
- ready() → { Component }
- readyState() → {number}
- remainingTime() → {number}
- remainingTimeDisplay() → {number}
- remoteTextTrackEls() → { HtmlTrackElementList }
- remoteTextTracks() → { TextTrackList }
- removeAttribute(attribute)
- removeChild(component)
- removeClass(classToRemove)
- removeRemoteTextTrack(track) → {undefined}
- reportUserActivity(event)
- requestAnimationFrame(fn) → {number}
- requestFullscreen(fullscreenOptionsopt)
- requestNamedAnimationFrame(name, fn)
- requestPictureInPicture() → {Promise}
- reset()
- resetControlBarUI_()
- resetPlaybackRate_()
- resetProgressBar_()
- resetVolumeBar_()
- responsive(value) → {boolean}
- runPlayCallbacks_(val)
- runPlayTerminatedQueue_()
- scrubbing(isScrubbingopt) → {boolean}
- seekable() → {TimeRanges}
- seeking() → {Boolean}
- selectSource(sources) → {Object|boolean}
- setAttribute(attribute, value)
- setInterval(fn, interval) → {number}
- setTimeout(fn, timeout) → {number}
- show()
- src(sourceopt) → {string|undefined}
- supportsFullScreen() → {boolean}
- tech(safetyopt) → { Tech }
- textTracks() → { TextTrackList }
- toggleClass(classToToggle, predicateopt)
- toJSON() → {Object}
- triggerReady()
- updateSourceCaches_(srcObj)
- userActive(boolopt) → {boolean}
- usingNativeControls(boolopt) → {boolean}
- usingPlugin(name) → {boolean}
- videoHeight() → {number}
- videoTracks() → { VideoTrackList }
- videoWidth() → {number}
- volume(percentAsDecimalopt) → {number}
- width(valueopt) → {number}
- Type Definitions
- Events
- beforepluginsetup:$name
- abort
- beforepluginsetup
- canplay
- canplaythrough
- componentresize
- controlsdisabled
- controlsenabled
- dispose
- durationchange
- emptied
- ended
- enterFullWindow
- enterpictureinpicture
- error
- exitFullWindow
- firstplay
- fullscreenchange
- languagechange
- leavepictureinpicture
- loadeddata
- loadeddata
- loadedmetadata
- loadedmetadata
- loadstart
- pause
- play
- playbackrateschange
- playerresize
- playing
- pluginsetup
- posterchange
- progress
- ratechange
- ready
- resize
- seeked
- seeking
- sourceset
- stalled
- suspend
- tap
- textdata
- texttrackchange
- timeupdate
- timeupdate
- useractive
- userinactive
- usingcustomcontrols
- usingnativecontrols
- volumechange
- volumechange
- waiting
- pluginsetup:$name
new Player(tag, optionsopt, readyopt)
[player.js](https://docs.videojs.com/player.js.html)
, [line 290](https://docs.videojs.com/player.js.html#line290)
Create an instance of this class.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tag | Element | The original video DOM element used for configuring options. | |
options | Object | <optional> | Object of option names and values. |
ready | Component~ReadyCallback | <optional> | Ready callback function. |
Extends
Members
static players :Object
[player.js](https://docs.videojs.com/player.js.html)
, [line 4999](https://docs.videojs.com/player.js.html#line4999)
Global enumeration of players.
The keys are the player IDs and the values are either the Player instance or null
for disposed players.
crossorigin
[player.js](https://docs.videojs.com/player.js.html)
, [line 4989](https://docs.videojs.com/player.js.html#line4989)
Get or set the Player
‘s crossorigin option. For the HTML5 player, this sets the crossOrigin
property on the <video>
tag to control the CORS behavior.
Methods
static getTagSettings(tag) → {Object}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4776](https://docs.videojs.com/player.js.html#line4776)
Gets tag settings
Parameters:
Name | Type | Description |
---|---|---|
tag | Element | The player tag |
Returns:
Object -
An object containing all of the settings for a player tag
$(selector, contextopt) → {Element|null}
[component.js](https://docs.videojs.com/component.js.html)
, [line 767](https://docs.videojs.com/component.js.html#line767)
Find a single DOM element matching a selector
. This can be within the Component
s contentEl()
or another custom context.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
selector | string | A valid CSS selector, which will be passed to | ||
context | Element | string | <optional> | this.contentEl() | A DOM element within which to query. Can also be a selector string in which case the first matching element will get used as context. If missing |
Returns:
Element | null -
the dom element that was found, or null
Overrides:
See:
$$(selector, contextopt) → {NodeList}
[component.js](https://docs.videojs.com/component.js.html)
, [line 789](https://docs.videojs.com/component.js.html#line789)
Finds all DOM element matching a selector
. This can be within the Component
s contentEl()
or another custom context.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
selector | string | A valid CSS selector, which will be passed to | ||
context | Element | string | <optional> | this.contentEl() | A DOM element within which to query. Can also be a selector string in which case the first matching element will get used as context. If missing |
Returns:
NodeList -
a list of dom elements that were found
Overrides:
See:
addChild(child, optionsopt, indexopt) → {Component}
[component.js](https://docs.videojs.com/component.js.html)
, [line 458](https://docs.videojs.com/component.js.html#line458)
Add a child Component
inside the current Component
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
child | string | Component | The name or instance of a child to add. | ||
options | Object | <optional> | {} | The key/value store of options that will get passed to children of the child. |
index | number | <optional> | this.children_.length | The index to attempt to add a child into. |
Returns:
The Component
that gets added as a child. When using a string the Component
will get created by this process.
Overrides:
addClass(classToAdd)
[component.js](https://docs.videojs.com/component.js.html)
, [line 813](https://docs.videojs.com/component.js.html#line813)
Add a CSS class name to the Component
s element.
Parameters:
Name | Type | Description |
---|---|---|
classToAdd | string | CSS class name to add |
Overrides:
addRemoteTextTrack(options, manualCleanupopt) → {HtmlTrackElement}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4298](https://docs.videojs.com/player.js.html#line4298)
Create a remote TextTrack and an HTMLTrackElement. When manualCleanup is set to false, the track will be automatically removed on source changes.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options | Object | Options to pass to HTMLTrackElement during creation. See HTMLTrackElement for object properties that you should use. | ||
manualCleanup | boolean | <optional> | true | if set to false, the TextTrack will be removed on a source change |
Returns:
HtmlTrackElement -
the HTMLTrackElement that was created and added to the HtmlTrackElementList and the remote TextTrackList
Deprecated:
- The default value of the “manualCleanup” parameter will default to “false” in upcoming versions of Video.js
addTextTrack(kindopt, labelopt, languageopt) → {TextTrack|undefined}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4272](https://docs.videojs.com/player.js.html#line4272)
A helper method for adding a TextTrack to our TextTrackList.
In addition to the W3C settings we allow adding additional info through options.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
kind | string | <optional> | the kind of TextTrack you are adding |
label | string | <optional> | the label to give the TextTrack label |
language | string | <optional> | the language to set on the TextTrack |
Returns:
TextTrack | undefined -
the TextTrack that was added or undefined if there is no tech
aspectRatio(ratioopt) → {string|undefined}
[player.js](https://docs.videojs.com/player.js.html)
, [line 992](https://docs.videojs.com/player.js.html#line992)
A getter/setter for the Player
‘s aspect ratio.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
ratio | string | <optional> | The value to set the |
Returns:
string | undefined -
- The current aspect ratio of the
Player
when getting. - undefined when setting
audioTracks() → {AudioTrackList}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4920](https://docs.videojs.com/player.js.html#line4920)
Get the AudioTrackList
Returns:
the current audio track list
autoplay(valueopt) → {boolean|string}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3677](https://docs.videojs.com/player.js.html#line3677)
Get or set the autoplay option. When this is a boolean it will modify the attribute on the tech. When this is a string the attribute on the tech will be removed and Player
will handle autoplay on loadstarts.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value | boolean | string | <optional> |
|
Returns:
boolean | string -
The current value of autoplay when getting
blur()
[component.js](https://docs.videojs.com/component.js.html)
, [line 1153](https://docs.videojs.com/component.js.html#line1153)
Remove the focus from this component
Overrides:
breakpoints(breakpointsopt) → {Object}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4556](https://docs.videojs.com/player.js.html#line4556)
Get or set breakpoints on the player.
Calling this method with an object or true
will remove any previous custom breakpoints and start from the defaults again.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
breakpoints | Object | boolean | <optional> | If an object is given, it can be used to provide custom breakpoints. If Properties
|
Returns:
Object -
An object mapping breakpoint names to maximum width values.
buffered() → {TimeRange}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2610](https://docs.videojs.com/player.js.html#line2610)
Get a TimeRange object with an array of the times of the video that have been downloaded. If you just want the percent of the video that’s been downloaded, use bufferedPercent.
Returns:
TimeRange -
A mock TimeRange object (following HTML spec)
See:
bufferedEnd() → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2639](https://docs.videojs.com/player.js.html#line2639)
Get the ending time of the last buffered time range This is used in the progress bar to encapsulate all time ranges.
Returns:
number -
The end of the last buffered time range
bufferedPercent() → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2628](https://docs.videojs.com/player.js.html#line2628)
Get the percent (as a decimal) of the video that’s been downloaded. This method is not a part of the native HTML video API.
Returns:
number -
A decimal between 0 and 1 representing the percent that is buffered 0 being 0% and 1 being 100%
abstract buildCSSClass() → {string}
[component.js](https://docs.videojs.com/component.js.html)
, [line 684](https://docs.videojs.com/component.js.html#line684)
Builds the default DOM class name. Should be overriden by sub-components.
Returns:
string -
The DOM class name for this object.
Overrides:
cancelAnimationFrame(id) → {number}
[component.js](https://docs.videojs.com/component.js.html)
, [line 1585](https://docs.videojs.com/component.js.html#line1585)
Cancels a queued callback passed to Component#requestAnimationFrame (rAF).
If you queue an rAF callback via Component#requestAnimationFrame, use this function instead of window.cancelAnimationFrame
. If you don’t, your dispose listener will not get cleaned up until Component#dispose!
Parameters:
Name | Type | Description |
---|---|---|
id | number | The rAF ID to clear. The return value of Component#requestAnimationFrame. |
Returns:
number -
Returns the rAF ID that was cleared.
Overrides:
See:
cancelNamedAnimationFrame(name)
[component.js](https://docs.videojs.com/component.js.html)
, [line 1560](https://docs.videojs.com/component.js.html#line1560)
Cancels a current named animation frame if it exists.
Parameters:
Name | Type | Description |
---|---|---|
name | string | The name of the requestAnimationFrame to cancel. |
Overrides:
canPlayType(type) → {string}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3227](https://docs.videojs.com/player.js.html#line3227)
Check whether the player can play a given mimetype
Parameters:
Name | Type | Description |
---|---|---|
type | string | The mimetype to check |
Returns:
string -
‘probably’, ‘maybe’, or ‘’ (empty string)
children() → {Array}
[component.js](https://docs.videojs.com/component.js.html)
, [line 375](https://docs.videojs.com/component.js.html#line375)
Get an array of all child components
Returns:
Array -
The children
Overrides:
clearInterval(intervalId) → {number}
[component.js](https://docs.videojs.com/component.js.html)
, [line 1464](https://docs.videojs.com/component.js.html#line1464)
Clears an interval that gets created via window.setInterval
or Component#setInterval. If you set an inteval via Component#setInterval use this function instead of window.clearInterval
. If you don’t your dispose listener will not get cleaned up until Component#dispose!
Parameters:
Name | Type | Description |
---|---|---|
intervalId | number | The id of the interval to clear. The return value of Component#setInterval or |
Returns:
number -
Returns the interval id that was cleared.
Overrides:
See:
clearTimeout(timeoutId) → {number}
[component.js](https://docs.videojs.com/component.js.html)
, [line 1408](https://docs.videojs.com/component.js.html#line1408)
Clears a timeout that gets created via window.setTimeout
or Component#setTimeout. If you set a timeout via Component#setTimeout use this function instead of window.clearTimout
. If you don’t your dispose listener will not get cleaned up until Component#dispose!
Parameters:
Name | Type | Description |
---|---|---|
timeoutId | number | The id of the timeout to clear. The return value of Component#setTimeout or |
Returns:
number -
Returns the timeout id that was cleared.
Overrides:
See:
contentEl() → {Element}
[component.js](https://docs.videojs.com/component.js.html)
, [line 344](https://docs.videojs.com/component.js.html#line344)
Return the Component
s DOM element. This is where children get inserted. This will usually be the the same as the element returned in Component#el.
Returns:
Element -
The content element for this Component
.
Overrides:
controls(boolopt) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3838](https://docs.videojs.com/player.js.html#line3838)
Get or set whether or not the controls are showing.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bool | boolean | <optional> |
|
Fires:
Returns:
boolean -
The current value of controls when getting
createEl() → {Element}
[player.js](https://docs.videojs.com/player.js.html)
, [line 656](https://docs.videojs.com/player.js.html#line656)
Create the Player
‘s DOM element.
Returns:
Element -
The DOM element that gets created.
Overrides:
createModal(content, optionsopt) → {ModalDialog}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4454](https://docs.videojs.com/player.js.html#line4454)
Creates a simple modal dialog (an instance of the ModalDialog component) that immediately overlays the player with arbitrary content and removes itself when closed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
content | string | function | Element | Array | null | Same as ModalDialog#content‘s param of the same name. The most straight-forward usage is to provide a string or DOM element. | |
options | Object | <optional> | Extra options which will be passed on to the ModalDialog. |
Returns:
the ModalDialog that was created
crossOrigin(valueopt) → {string|undefined}
[player.js](https://docs.videojs.com/player.js.html)
, [line 824](https://docs.videojs.com/player.js.html#line824)
Get or set the Player
‘s crossOrigin option. For the HTML5 player, this sets the crossOrigin
property on the <video>
tag to control the CORS behavior.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value | string | <optional> | The value to set the |
Returns:
string | undefined -
The current crossOrigin value of the
Player
when getting. - undefined when settingSee:
currentBreakpoint() → {string}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4626](https://docs.videojs.com/player.js.html#line4626)
Get current breakpoint name, if any.
Returns:
string -
If there is currently a breakpoint set, returns a the key from the breakpoints object matching it. Otherwise, returns an empty string.
currentBreakpointClass() → {string}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4638](https://docs.videojs.com/player.js.html#line4638)
Get the current breakpoint class name.
Returns:
string -
The matching class name (e.g. "vjs-layout-tiny"
or "vjs-layout-large"
) for the current breakpoint. Empty string if there is no current breakpoint.
currentDimension(widthOrHeight) → {number}
[component.js](https://docs.videojs.com/component.js.html)
, [line 1066](https://docs.videojs.com/component.js.html#line1066)
Get the computed width or the height of the component’s element.
Uses window.getComputedStyle
.
Parameters:
Name | Type | Description |
---|---|---|
widthOrHeight | string | A string containing ‘width’ or ‘height’. Whichever one you want to get. |
Returns:
number -
The dimension that gets asked for or 0 if nothing was set for that dimension.
Overrides:
currentDimensions() → {Component~DimensionObject}
[component.js](https://docs.videojs.com/component.js.html)
, [line 1112](https://docs.videojs.com/component.js.html#line1112)
Get an object that contains computed width and height values of the component’s element.
Uses window.getComputedStyle
.
Returns:
The computed dimensions of the component’s element.
Overrides:
currentHeight() → {number}
[component.js](https://docs.videojs.com/component.js.html)
, [line 1139](https://docs.videojs.com/component.js.html#line1139)
Get the computed height of the component’s element.
Uses window.getComputedStyle
.
Returns:
number -
The computed height of the component’s element.
Overrides:
currentSource() → {Tech~SourceObject}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3615](https://docs.videojs.com/player.js.html#line3615)
Returns the current source object.
Returns:
The current source object
currentSources() → {Array.<Tech~SourceObject>}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3597](https://docs.videojs.com/player.js.html#line3597)
Returns all of the current source objects.
Returns:
Array.<Tech~SourceObject> -
The current source objects
currentSrc() → {string}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3626](https://docs.videojs.com/player.js.html#line3626)
Returns the fully qualified URL of the current source value e.g. http://mysite.com/video.mp4 Can be used in conjunction with currentType
to assist in rebuilding the current source object.
Returns:
string -
The current source
currentTime(secondsopt) → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2488](https://docs.videojs.com/player.js.html#line2488)
Get or set the current time (in seconds)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
seconds | number | string | <optional> | The time to seek to in seconds |
Returns:
number -
- the current time in seconds when getting
currentType() → {string}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3638](https://docs.videojs.com/player.js.html#line3638)
Get the current source type e.g. video/mp4 This can allow you rebuild the current source object so that you could load the same source and tech later
Returns:
string -
The source MIME type
currentWidth() → {number}
[component.js](https://docs.videojs.com/component.js.html)
, [line 1127](https://docs.videojs.com/component.js.html#line1127)
Get the computed width of the component’s element.
Uses window.getComputedStyle
.
Returns:
number -
The computed width of the component’s element.
Overrides:
debug(enabled)
[player.js](https://docs.videojs.com/player.js.html)
, [line 4853](https://docs.videojs.com/player.js.html#line4853)
Set debug mode to enable/disable logs at info level.
Parameters:
Name | Type | Description |
---|---|---|
enabled | boolean |
Fires:
- Player#event:debugon
- Player#event:debugoff
defaultMuted(defaultMutedopt) → {boolean|Player}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2729](https://docs.videojs.com/player.js.html#line2729)
Get the current defaultMuted state, or turn defaultMuted on or off. defaultMuted indicates the state of muted on initial playback.
var myPlayer = videojs('some-player-id');
myPlayer.src("http://www.example.com/path/to/video.mp4");
// get, should be false
console.log(myPlayer.defaultMuted());
// set to true
myPlayer.defaultMuted(true);
// get should be true
console.log(myPlayer.defaultMuted());
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
defaultMuted | boolean | <optional> |
|
Returns:
boolean | Player -
- true if defaultMuted is on and getting - false if defaultMuted is off and getting - A reference to the current player when setting
defaultPlaybackRate(rateopt) → {number|Player}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4221](https://docs.videojs.com/player.js.html#line4221)
Gets or sets the current default playback rate. A default playback rate of 1.0 represents normal speed and 0.5 would indicate half-speed playback, for instance. defaultPlaybackRate will only represent what the initial playbackRate of a video was, not not the current playbackRate.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
rate | number | <optional> | New default playback rate to set. |
Returns:
number | Player -
The default playback rate when getting or 1.0 - the player when setting
See:
dimension(dimension, valueopt) → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 881](https://docs.videojs.com/player.js.html#line881)
A getter/setter for the Player
‘s width & height.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
dimension | string | This string can be: - ‘width’ - ‘height’ | |
value | number | <optional> | Value for dimension specified in the first argument. |
Returns:
number -
The dimension arguments value when getting (width/height).
Overrides:
dimensions(width, height)
[component.js](https://docs.videojs.com/component.js.html)
, [line 969](https://docs.videojs.com/component.js.html#line969)
Set both the width and height of the Component
element at the same time.
Parameters:
Name | Type | Description |
---|---|---|
width | number | string | Width to set the |
height | number | string | Height to set the |
Overrides:
disablePictureInPicture(value)
[player.js](https://docs.videojs.com/player.js.html)
, [line 3030](https://docs.videojs.com/player.js.html#line3030)
Disable Picture-in-Picture mode.
Parameters:
Name | Type | Description |
---|---|---|
value | boolean |
|
dispose()
[player.js](https://docs.videojs.com/player.js.html)
, [line 585](https://docs.videojs.com/player.js.html#line585)
Destroys the video player and does any necessary cleanup.
This is especially helpful if you are dynamically adding and removing videos to/from the DOM.
Fires:
Overrides:
documentFullscreenChange_()
[player.js](https://docs.videojs.com/player.js.html)
, [line 2073](https://docs.videojs.com/player.js.html#line2073)
when the document fschange event triggers it calls this
duration(secondsopt) → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2539](https://docs.videojs.com/player.js.html#line2539)
Normally gets the length in time of the video in seconds; in all but the rarest use cases an argument will NOT be passed to the method
NOTE: The video must have started loading before the duration can be known, and depending on preload behaviour may not be known until the video starts playing.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
seconds | number | <optional> | The duration of the video to set in seconds |
Fires:
Returns:
number -
- The duration of the video in seconds when getting
el() → {Element}
[component.js](https://docs.videojs.com/component.js.html)
, [line 237](https://docs.videojs.com/component.js.html#line237)
Get the Component
s DOM element
Returns:
Element -
The DOM element for this Component
.
Overrides:
enableTouchActivity()
[component.js](https://docs.videojs.com/component.js.html)
, [line 1307](https://docs.videojs.com/component.js.html#line1307)
This function reports user activity whenever touch events happen. This can get turned off by any sub-components that wants touch events to act another way.
Report user touch activity when touch events occur. User activity gets used to determine when controls should show/hide. It is simple when it comes to mouse events, because any mouse event should show the controls. So we capture mouse events that bubble up to the player and report activity when that happens. With touch events it isn’t as easy as touchstart
and touchend
toggle player controls. So touch events can’t help us at the player level either.
User activity gets checked asynchronously. So what could happen is a tap event on the video turns the controls off. Then the touchend
event bubbles up to the player. Which, if it reported user activity, would turn the controls right back on. We also don’t want to completely block touch events from bubbling up. Furthermore a touchmove
event and anything other than a tap, should not turn controls back on.
Listens to Events:
- Component#event:touchstart
- Component#event:touchmove
- Component#event:touchend
Component#event:touchcancel
Overrides:
ended() → {Boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 5061](https://docs.videojs.com/player.js.html#line5061)
Returns whether or not the player is in the “ended” state.
Returns:
Boolean -
True if the player is in the ended state, false if not.
enterFullWindow()
[player.js](https://docs.videojs.com/player.js.html)
, [line 2956](https://docs.videojs.com/player.js.html#line2956)
When fullscreen isn’t supported we can stretch the video container to as wide as the browser will let us.
Fires:
error(erropt) → {MediaError|null}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3947](https://docs.videojs.com/player.js.html#line3947)
Set or get the current MediaError
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err | MediaError | string | number | <optional> | A MediaError or a string/number to be turned into a MediaError |
Fires:
Returns:
MediaError | null -
The current MediaError when getting (or null)
exitFullscreen()
[player.js](https://docs.videojs.com/player.js.html)
, [line 2899](https://docs.videojs.com/player.js.html#line2899)
Return the video to its normal size after having been in full screen mode
Fires:
exitFullWindow()
[player.js](https://docs.videojs.com/player.js.html)
, [line 3003](https://docs.videojs.com/player.js.html#line3003)
Exit full window
Fires:
exitPictureInPicture() → {Promise}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3093](https://docs.videojs.com/player.js.html#line3093)
Exit Picture-in-Picture mode.
Fires:
Returns:
Promise -
A promise.
See:
fill(boolopt) → {boolean|undefined}
[player.js](https://docs.videojs.com/player.js.html)
, [line 957](https://docs.videojs.com/player.js.html#line957)
A getter/setter/toggler for the vjs-fill className
on the Player
.
Turning this on will turn off fluid mode.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bool | boolean | <optional> |
|
Returns:
boolean | undefined -
- The value of fluid when getting. -
undefined
when setting.
flexNotSupported_() → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4833](https://docs.videojs.com/player.js.html#line4833)
Determine whether or not flexbox is supported
Returns:
boolean -
- true if flexbox is supported - false if flexbox is not supported
fluid(boolopt) → {boolean|undefined}
[player.js](https://docs.videojs.com/player.js.html)
, [line 920](https://docs.videojs.com/player.js.html#line920)
A getter/setter/toggler for the vjs-fluid className
on the Player
.
Turning this on will turn off fill mode.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bool | boolean | <optional> |
|
Returns:
boolean | undefined -
- The value of fluid when getting. -
undefined
when setting.
focus()
[component.js](https://docs.videojs.com/component.js.html)
, [line 1146](https://docs.videojs.com/component.js.html#line1146)
Set the focus to this component
Overrides:
fullWindowOnEscKey(event)
[player.js](https://docs.videojs.com/player.js.html)
, [line 2986](https://docs.videojs.com/player.js.html#line2986)
Check for call to either exit full window or full screen on ESC key
Parameters:
Name | Type | Description |
---|---|---|
event | string | Event to check for key press |
getAttribute(attribute) → {string|null}
[component.js](https://docs.videojs.com/component.js.html)
, [line 893](https://docs.videojs.com/component.js.html#line893)
Get the value of an attribute on the Component
s element.
Parameters:
Name | Type | Description |
---|---|---|
attribute | string | Name of the attribute to get the value from. |
Returns:
string | null -
The value of the attribute that was asked for. - Can be an empty string on some browsers if the attribute does not exist or has no value - Most browsers will return null if the attibute does not exist or has no value.
Overrides:
See:
getCache() → {Object}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2198](https://docs.videojs.com/player.js.html#line2198)
Get object for cached values.
Returns:
Object -
get the current object cache
getChild(name) → {Component|undefined}
[component.js](https://docs.videojs.com/component.js.html)
, [line 401](https://docs.videojs.com/component.js.html#line401)
Returns the child Component
with the given name
.
Parameters:
Name | Type | Description |
---|---|---|
name | string | The name of the child |
Returns:
Component | undefined -
The child Component
with the given name
or undefined.
Overrides:
getChildById(id) → {Component|undefined}
[component.js](https://docs.videojs.com/component.js.html)
, [line 388](https://docs.videojs.com/component.js.html#line388)
Returns the child Component
with the given id
.
Parameters:
Name | Type | Description |
---|---|---|
id | string | The id of the child |
Returns:
Component | undefined -
The child Component
with the given id
or undefined.
Overrides:
getDescendant(…names) → {Component|undefined}
[component.js](https://docs.videojs.com/component.js.html)
, [line 423](https://docs.videojs.com/component.js.html#line423)
Returns the descendant Component
following the givent descendant names
. For instance [‘foo’, ‘bar’, ‘baz’] would try to get ‘foo’ on the current component, ‘bar’ on the ‘foo’ component and ‘baz’ on the ‘bar’ component and return undefined if any of those don’t exist.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
names | …Array.<string> | string | <repeatable> | The name of the child |
Returns:
Component | undefined -
The descendant Component
following the given descendant names
or undefined.
Overrides:
getMedia() → {Player~MediaObject}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4739](https://docs.videojs.com/player.js.html#line4739)
Get a clone of the current Player~MediaObject for this player.
If the loadMedia
method has not been used, will attempt to return a Player~MediaObject based on the current state of the player.
Returns:
getVideoPlaybackQuality() → {Object|undefined}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4339](https://docs.videojs.com/player.js.html#line4339)
Gets available media playback quality metrics as specified by the W3C’s Media Playback Quality API.
Returns:
Object | undefined -
An object with supported media playback quality metrics or undefined if there is no tech or the tech does not support it.
See:
handleHotkeys(event)
[player.js](https://docs.videojs.com/player.js.html)
, [line 3178](https://docs.videojs.com/player.js.html#line3178)
Called when this Player receives a hotkey keydown event. Supported player-wide hotkeys are:
f - toggle fullscreen m - toggle mute k or Space - toggle play/pause
Parameters:
Name | Type | Description |
---|---|---|
event | EventTarget~Event | The |
handleKeyDown(event)
[player.js](https://docs.videojs.com/player.js.html)
, [line 3116](https://docs.videojs.com/player.js.html#line3116)
Called when this Player has focus and a key gets pressed down, or when any Component of this player receives a key press that it doesn’t handle. This allows player-wide hotkeys (either as defined below, or optionally by an external function).
Parameters:
Name | Type | Description |
---|---|---|
event | EventTarget~Event | The |
Listens to Events:
event:keydown
Overrides:
handleKeyPress(event)
[component.js](https://docs.videojs.com/component.js.html)
, [line 1183](https://docs.videojs.com/component.js.html#line1183)
Many components used to have a handleKeyPress
method, which was poorly named because it listened to a keydown
event. This method name now delegates to handleKeyDown
. This means anyone calling handleKeyPress
will not see their method calls stop working.
Parameters:
Name | Type | Description |
---|---|---|
event | EventTarget~Event | The event that caused this function to be called. |
Overrides:
abstract handleLanguagechange()
[component.js](https://docs.videojs.com/component.js.html)
, [line 335](https://docs.videojs.com/component.js.html#line335)
Handles language change for the player in components. Should be overriden by sub-components.
Overrides:
handleSrc_(sourceopt, isRetry) → {string|undefined}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3347](https://docs.videojs.com/player.js.html#line3347)
Executes source setting and getting logic
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
source | Tech~SourceObject | Array.<Tech~SourceObject> | string | <optional> | A SourceObject, an array of SourceObjects, or a string referencing a URL to a media source. It is highly recommended that an object or array of objects is used here, so that source selection algorithms can take the
|
isRetry | boolean | Indicates whether this is being called internally as a result of a retry |
Returns:
string | undefined -
If the source
argument is missing, returns the current source URL. Otherwise, returns nothing/undefined.
hasClass(classToCheck) → {boolean}
[component.js](https://docs.videojs.com/component.js.html)
, [line 803](https://docs.videojs.com/component.js.html#line803)
Check if a component’s element has a CSS class name.
Parameters:
Name | Type | Description |
---|---|---|
classToCheck | string | CSS class name to check. |
Returns:
boolean -
True if the
Component
has the class. - False if theComponent
does not have the class`Overrides:
hasPlugin(name) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 5170](https://docs.videojs.com/player.js.html#line5170)
Reports whether or not a player has a plugin available.
This does not report whether or not the plugin has ever been initialized on this player. For that, usingPlugin.
Parameters:
Name | Type | Description |
---|---|---|
name | string | The name of a plugin. |
Returns:
boolean -
Whether or not this player has the requested plugin available.
hasStarted(request) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 1640](https://docs.videojs.com/player.js.html#line1640)
Add/remove the vjs-has-started class
Parameters:
Name | Type | Description |
---|---|---|
request | boolean |
|
Fires:
Returns:
boolean -
the boolean value of hasStarted_
height(valueopt) → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 863](https://docs.videojs.com/player.js.html#line863)
A getter/setter for the Player
‘s height. Returns the player’s configured value. To get the current height use currentheight()
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value | number | <optional> | The value to set the |
Returns:
number -
The current height of the Player
when getting.
Overrides:
hide()
[component.js](https://docs.videojs.com/component.js.html)
, [line 854](https://docs.videojs.com/component.js.html#line854)
Hide the Component
s element if it is currently showing by adding the ‘vjs-hidden` class name to it.
Overrides:
id() → {string}
[component.js](https://docs.videojs.com/component.js.html)
, [line 354](https://docs.videojs.com/component.js.html#line354)
Get this Component
s ID
Returns:
string -
The id of this Component
Overrides:
initChildren()
[component.js](https://docs.videojs.com/component.js.html)
, [line 581](https://docs.videojs.com/component.js.html#line581)
Add and initialize default child Component
s based upon options.
Overrides:
isAudio(bool) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4242](https://docs.videojs.com/player.js.html#line4242)
Gets or sets the audio flag
Parameters:
Name | Type | Description |
---|---|---|
bool | boolean |
|
Returns:
boolean -
The current value of isAudio when getting
isDisposed() → {boolean}
[component.js](https://docs.videojs.com/component.js.html)
, [line 197](https://docs.videojs.com/component.js.html#line197)
Determine whether or not this component has been disposed.
Returns:
boolean -
If the component has been disposed, will be true
. Otherwise, false
.
Overrides:
isFullscreen(isFSopt) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2784](https://docs.videojs.com/player.js.html#line2784)
Check if the player is in fullscreen mode or tell the player that it is or is not in fullscreen mode.
NOTE: As of the latest HTML5 spec, isFullscreen is no longer an official property and instead document.fullscreenElement is used. But isFullscreen is still a valuable property for internal player workings.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
isFS | boolean | <optional> | Set the players current fullscreen state |
Returns:
boolean -
- true if fullscreen is on and getting - false if fullscreen is off and getting
isInPictureInPicture(isPiPopt) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3050](https://docs.videojs.com/player.js.html#line3050)
Check if the player is in Picture-in-Picture mode or tell the player that it is or is not in Picture-in-Picture mode.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
isPiP | boolean | <optional> | Set the players current Picture-in-Picture state |
Returns:
boolean -
- true if Picture-in-Picture is on and getting - false if Picture-in-Picture is off and getting
language(codeopt) → {string}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4380](https://docs.videojs.com/player.js.html#line4380)
The player’s language code.
Changing the langauge will trigger languagechange which Components can use to update control text. ClickableComponent will update its control text by default on languagechange.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
code | string | <optional> | the language code to set the player to |
Fires:
Returns:
string -
The current language code when getting
languages() → {Array}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4409](https://docs.videojs.com/player.js.html#line4409)
Get the player’s language dictionary Merge every time, because a newly added plugin might call videojs.addLanguage() at any time Languages specified directly in the player options have precedence
Returns:
Array -
An array of of supported languages
load()
[player.js](https://docs.videojs.com/player.js.html)
, [line 3513](https://docs.videojs.com/player.js.html#line3513)
Begin loading the src data.
loadMedia(media, ready)
[player.js](https://docs.videojs.com/player.js.html)
, [line 4696](https://docs.videojs.com/player.js.html#line4696)
Populate the player using a MediaObject.
Parameters:
Name | Type | Description |
---|---|---|
media | Player~MediaObject | A media object. |
ready | function | A callback to be called when the player is ready. |
localize(string, tokensopt, defaultValueopt) → {string}
[component.js](https://docs.videojs.com/component.js.html)
, [line 298](https://docs.videojs.com/component.js.html#line298)
Localize a string given the string in english.
If tokens are provided, it’ll try and run a simple token replacement on the provided string. The tokens it looks for look like {1}
with the index being 1-indexed into the tokens array.
If a defaultValue
is provided, it’ll use that over string
, if a value isn’t found in provided language files. This is useful if you want to have a descriptive key for token replacement but have a succinct localized string and not require en.json
to be included.
Currently, it is used for the progress bar timing.
{
"progress bar timing: currentTime={1} duration={2}": "{1} of {2}"
}
It is then used like so:
this.localize('progress bar timing: currentTime={1} duration{2}',
[this.player_.currentTime(), this.player_.duration()],
'{1} of {2}');
Which outputs something like: 01:23 of 24:56
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
string | string | The string to localize and the key to lookup in the language files. | |
tokens | Array.<string> | <optional> | If the current item has token replacements, provide the tokens here. |
defaultValue | string | <optional> | Defaults to |
Returns:
string -
The localized string or if no localization exists the english string.
Overrides:
loop(valueopt) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3747](https://docs.videojs.com/player.js.html#line3747)
Get or set the loop attribute on the video element.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value | boolean | <optional> |
|
Returns:
boolean -
The current value of loop when getting
manualAutoplay_()
[player.js](https://docs.videojs.com/player.js.html)
, [line 1428](https://docs.videojs.com/player.js.html#line1428)
Handle autoplay string values, rather than the typical boolean values that should be handled by the tech. Note that this is not part of any specification. Valid values and what they do can be found on the autoplay getter at Player#autoplay()
muted(mutedopt) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2695](https://docs.videojs.com/player.js.html#line2695)
Get the current muted state, or turn mute on or off
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
muted | boolean | <optional> |
|
Returns:
boolean -
- true if mute is on and getting - false if mute is off and getting
name() → {string}
[component.js](https://docs.videojs.com/component.js.html)
, [line 365](https://docs.videojs.com/component.js.html#line365)
Get the Component
s name. The name gets used to reference the Component
and is set during registration.
Returns:
string -
The name of this Component
.
Overrides:
networkState() → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 5083](https://docs.videojs.com/player.js.html#line5083)
Returns the current state of network activity for the element, from the codes in the list below.
- NETWORK_EMPTY (numeric value 0) The element has not yet been initialised. All attributes are in their initial states.
- NETWORK_IDLE (numeric value 1) The element’s resource selection algorithm is active and has selected a resource, but it is not actually using the network at this time.
- NETWORK_LOADING (numeric value 2) The user agent is actively trying to download data.
- NETWORK_NO_SOURCE (numeric value 3) The element’s resource selection algorithm is active, but it has not yet found a resource to use.
Returns:
number -
the current network activity state
options(obj) → {Object}
[component.js](https://docs.videojs.com/component.js.html)
, [line 222](https://docs.videojs.com/component.js.html#line222)
Deep merge of options objects with new options.
Note: When both
obj
andoptions
contain properties whose values are objects. The two properties get merged using module:mergeOptions
Parameters:
Name | Type | Description |
---|---|---|
obj | Object | The object that contains new options. |
Returns:
Object -
A new object of this.options_
and obj
merged together.
Overrides:
pause() → {Player}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2426](https://docs.videojs.com/player.js.html#line2426)
Pause the video playback
Returns:
Player -
A reference to the player object this function was called on
paused() → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2437](https://docs.videojs.com/player.js.html#line2437)
Check if the player is paused or has yet to play
Returns:
boolean -
- false: if the media is currently playing - true: if media is not currently playing
play() → {Promise|undefined}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2325](https://docs.videojs.com/player.js.html#line2325)
Attempt to begin playback at the first opportunity.
Returns:
Promise | undefined -
Returns a promise if the browser supports Promises (or one was passed in as an option). This promise will be resolved on the return value of play. If this is undefined it will fulfill the promise chain otherwise the promise chain will be fulfilled when the promise from play is fulfilled.
playbackRate(rateopt) → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4192](https://docs.videojs.com/player.js.html#line4192)
Gets or sets the current playback rate. A playback rate of 1.0 represents normal speed and 0.5 would indicate half-speed playback, for instance.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
rate | number | <optional> | New playback rate to set. |
Returns:
number -
The current playback rate when getting or 1.0
playbackRates(newRates) → {Array.<number>}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4883](https://docs.videojs.com/player.js.html#line4883)
Set or get current playback rates. Takes an array and updates the playback rates menu with the new items. Pass in an empty array to hide the menu. Values other than arrays are ignored.
Parameters:
Name | Type | Description |
---|---|---|
newRates | Array.<number> | The new rates that the playback rates menu should update to. An empty array will hide the menu |
Fires:
Returns:
Array.<number> -
When used as a getter will return the current playback rates
played() → {TimeRange}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2450](https://docs.videojs.com/player.js.html#line2450)
Get a TimeRange object representing the current ranges of time that the user has played.
Returns:
TimeRange -
A time range object that represents all the increments of time that have been played.
player() → {Player}
[component.js](https://docs.videojs.com/component.js.html)
, [line 207](https://docs.videojs.com/component.js.html#line207)
Return the Player that the Component
has attached to.
Returns:
Player -
The player that this Component
has attached to.
Overrides:
playsinline(valueopt) → {string|Player}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3728](https://docs.videojs.com/player.js.html#line3728)
Set or unset the playsinline attribute. Playsinline tells the browser that non-fullscreen playback is preferred.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value | boolean | <optional> |
|
Returns:
string | Player -
the current value of playsinline - the player when setting
See:
poster(srcopt) → {string}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3767](https://docs.videojs.com/player.js.html#line3767)
Get or set the poster image source url
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
src | string | <optional> | Poster image source URL |
Fires:
Returns:
string -
The current value of poster when getting
preload(valueopt) → {string}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3652](https://docs.videojs.com/player.js.html#line3652)
Get or set the preload attribute
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value | boolean | <optional> |
|
Returns:
string -
The preload attribute value when getting
ready() → {Component}
[component.js](https://docs.videojs.com/component.js.html)
, [line 698](https://docs.videojs.com/component.js.html#line698)
Bind a listener to the component’s ready state. Different from event listeners in that if the ready event has already happened it will trigger the function immediately.
Returns:
Returns itself; method can be chained.
Overrides:
readyState() → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 5104](https://docs.videojs.com/player.js.html#line5104)
Returns a value that expresses the current state of the element with respect to rendering the current playback position, from the codes in the list below.
- HAVE_NOTHING (numeric value 0) No information regarding the media resource is available.
- HAVE_METADATA (numeric value 1) Enough of the resource has been obtained that the duration of the resource is available.
- HAVE_CURRENT_DATA (numeric value 2) Data for the immediate current playback position is available.
- HAVE_FUTURE_DATA (numeric value 3) Data for the immediate current playback position is available, as well as enough data for the user agent to advance the current playback position in the direction of playback.
- HAVE_ENOUGH_DATA (numeric value 4) The user agent estimates that enough data is available for playback to proceed uninterrupted.
Returns:
number -
the current playback rendering state
remainingTime() → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2582](https://docs.videojs.com/player.js.html#line2582)
Calculates how much time is left in the video. Not part of the native video API.
Returns:
number -
The time remaining in seconds
remainingTimeDisplay() → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2593](https://docs.videojs.com/player.js.html#line2593)
A remaining time function that is intented to be used when the time is to be displayed directly to the user.
Returns:
number -
The rounded time remaining in seconds
remoteTextTrackEls() → {HtmlTrackElementList}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4950](https://docs.videojs.com/player.js.html#line4950)
Get the remote HtmlTrackElementList tracks.
Returns:
The current remote text track element list
remoteTextTracks() → {TextTrackList}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4941](https://docs.videojs.com/player.js.html#line4941)
Get the remote TextTrackList
Returns:
The current remote text track list
removeAttribute(attribute)
[component.js](https://docs.videojs.com/component.js.html)
, [line 920](https://docs.videojs.com/component.js.html#line920)
Remove an attribute from the Component
s element.
Parameters:
Name | Type | Description |
---|---|---|
attribute | string | Name of the attribute to remove. |
Overrides:
See:
removeChild(component)
[component.js](https://docs.videojs.com/component.js.html)
, [line 542](https://docs.videojs.com/component.js.html#line542)
Remove a child Component
from this Component
s list of children. Also removes the child Component
s element from this Component
s element.
Parameters:
Name | Type | Description |
---|---|---|
component | Component | The child |
Overrides:
removeClass(classToRemove)
[component.js](https://docs.videojs.com/component.js.html)
, [line 823](https://docs.videojs.com/component.js.html#line823)
Remove a CSS class name from the Component
s element.
Parameters:
Name | Type | Description |
---|---|---|
classToRemove | string | CSS class name to remove |
Overrides:
removeRemoteTextTrack(track) → {undefined}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4314](https://docs.videojs.com/player.js.html#line4314)
Remove a remote TextTrack from the respective TextTrackList and HtmlTrackElementList.
Parameters:
Name | Type | Description |
---|---|---|
track | Object | Remote TextTrack to remove |
Returns:
undefined -
does not return anything
reportUserActivity(event)
[player.js](https://docs.videojs.com/player.js.html)
, [line 4003](https://docs.videojs.com/player.js.html#line4003)
Report user activity
Parameters:
Name | Type | Description |
---|---|---|
event | Object | Event object |
requestAnimationFrame(fn) → {number}
[component.js](https://docs.videojs.com/component.js.html)
, [line 1498](https://docs.videojs.com/component.js.html#line1498)
Queues up a callback to be passed to requestAnimationFrame (rAF), but with a few extra bonuses:
Supports browsers that do not support rAF by falling back to Component#setTimeout.
The callback is turned into a Component~GenericCallback (i.e. bound to the component).
Automatic cancellation of the rAF callback is handled if the component is disposed before it is called.
Parameters:
Name | Type | Description |
---|---|---|
fn | Component~GenericCallback | A function that will be bound to this component and executed just before the browser’s next repaint. |
Listens to Events:
Returns:
number -
Returns an rAF ID that gets used to identify the timeout. It can also be used in Component#cancelAnimationFrame to cancel the animation frame callback.
Overrides:
See:
requestFullscreen(fullscreenOptionsopt)
[player.js](https://docs.videojs.com/player.js.html)
, [line 2821](https://docs.videojs.com/player.js.html#line2821)
Increase the size of the video to full screen In some browsers, full screen is not supported natively, so it enters “full window mode”, where the video fills the browser window. In browsers and devices that support native full screen, sometimes the browser’s default controls will be shown, and not the Video.js custom skin. This includes most mobile devices (iOS, Android) and older versions of Safari.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fullscreenOptions | Object | <optional> | Override the player fullscreen options |
Fires:
requestNamedAnimationFrame(name, fn)
[component.js](https://docs.videojs.com/component.js.html)
, [line 1534](https://docs.videojs.com/component.js.html#line1534)
Request an animation frame, but only one named animation frame will be queued. Another will never be added until the previous one finishes.
Parameters:
Name | Type | Description |
---|---|---|
name | string | The name to give this requestAnimationFrame |
fn | Component~GenericCallback | A function that will be bound to this component and executed just before the browser’s next repaint. |
Overrides:
requestPictureInPicture() → {Promise}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3071](https://docs.videojs.com/player.js.html#line3071)
Create a floating video window always on top of other windows so that users may continue consuming media while they interact with other content sites, or applications on their device.
Fires:
Returns:
Promise -
A promise with a Picture-in-Picture window.
See:
reset()
[player.js](https://docs.videojs.com/player.js.html)
, [line 3522](https://docs.videojs.com/player.js.html#line3522)
Reset the player. Loads the first tech in the techOrder, removes all the text tracks in the existing tech
, and calls reset
on the tech
.
resetControlBarUI_()
[player.js](https://docs.videojs.com/player.js.html)
, [line 3552](https://docs.videojs.com/player.js.html#line3552)
Reset Control Bar’s UI by calling sub-methods that reset all of Control Bar’s components
resetPlaybackRate_()
[player.js](https://docs.videojs.com/player.js.html)
, [line 3578](https://docs.videojs.com/player.js.html#line3578)
Reset Playback ratio
resetProgressBar_()
[player.js](https://docs.videojs.com/player.js.html)
, [line 3561](https://docs.videojs.com/player.js.html#line3561)
Reset tech’s progress so progress bar is reset in the UI
resetVolumeBar_()
[player.js](https://docs.videojs.com/player.js.html)
, [line 3586](https://docs.videojs.com/player.js.html#line3586)
Reset Volume bar
responsive(value) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4586](https://docs.videojs.com/player.js.html#line4586)
Get or set a flag indicating whether or not this player should adjust its UI based on its dimensions.
Parameters:
Name | Type | Description |
---|---|---|
value | boolean | Should be |
Returns:
boolean -
Will be true
if this player should adjust its UI based on its dimensions; otherwise, will be false
.
runPlayCallbacks_(val)
[player.js](https://docs.videojs.com/player.js.html)
, [line 2408](https://docs.videojs.com/player.js.html#line2408)
When a callback to play is delayed we have to run these callbacks when play is actually called on the tech. This function runs the callbacks that were delayed and accepts the return value from the tech.
Parameters:
Name | Type | Description |
---|---|---|
val | undefined | Promise | The return value from the tech. |
runPlayTerminatedQueue_()
[player.js](https://docs.videojs.com/player.js.html)
, [line 2389](https://docs.videojs.com/player.js.html#line2389)
These functions will be run when if play is terminated. If play runPlayCallbacks_ is run these function will not be run. This allows us to differenciate between a terminated play and an actual call to play.
scrubbing(isScrubbingopt) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2465](https://docs.videojs.com/player.js.html#line2465)
Returns whether or not the user is “scrubbing”. Scrubbing is when the user has clicked the progress bar handle and is dragging it along the progress bar.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
isScrubbing | boolean | <optional> | whether the user is or is not scrubbing |
Returns:
boolean -
The value of scrubbing when getting
seekable() → {TimeRanges}
[player.js](https://docs.videojs.com/player.js.html)
, [line 5075](https://docs.videojs.com/player.js.html#line5075)
Returns the TimeRanges of the media that are currently available for seeking to.
Returns:
TimeRanges -
the seekable intervals of the media timeline
seeking() → {Boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 5068](https://docs.videojs.com/player.js.html#line5068)
Returns whether or not the player is in the “seeking” state.
Returns:
Boolean -
True if the player is in the seeking state, false if not.
selectSource(sources) → {Object|boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3271](https://docs.videojs.com/player.js.html#line3271)
Select source based on tech-order or source-order Uses source-order selection if options.sourceOrder
is truthy. Otherwise, defaults to tech-order selection
Parameters:
Name | Type | Description |
---|---|---|
sources | Array | The sources for a media asset |
Returns:
Object | boolean -
Object of source and tech order or false
setAttribute(attribute, value)
[component.js](https://docs.videojs.com/component.js.html)
, [line 908](https://docs.videojs.com/component.js.html#line908)
Set the value of an attribute on the Component
‘s element
Parameters:
Name | Type | Description |
---|---|---|
attribute | string | Name of the attribute to set. |
value | string | Value to set the attribute to. |
Overrides:
See:
setInterval(fn, interval) → {number}
[component.js](https://docs.videojs.com/component.js.html)
, [line 1437](https://docs.videojs.com/component.js.html#line1437)
Creates a function that gets run every x
milliseconds. This function is a wrapper around window.setInterval
. There are a few reasons to use this one instead though.
- It gets cleared via Component#clearInterval when Component#dispose gets called.
- The function callback will be a Component~GenericCallback
Parameters:
Name | Type | Description |
---|---|---|
fn | Component~GenericCallback | The function to run every |
interval | number | Execute the specified function every |
Listens to Events:
Returns:
number -
Returns an id that can be used to identify the interval. It can also be be used in Component#clearInterval to clear the interval.
Overrides:
See:
setTimeout(fn, timeout) → {number}
[component.js](https://docs.videojs.com/component.js.html)
, [line 1372](https://docs.videojs.com/component.js.html#line1372)
Creates a function that runs after an x
millisecond timeout. This function is a wrapper around window.setTimeout
. There are a few reasons to use this one instead though:
- It gets cleared via Component#clearTimeout when Component#dispose gets called.
- The function callback will gets turned into a Component~GenericCallback
Note: You can’t use
window.clearTimeout
on the id returned by this function. This will cause its dispose listener not to get cleaned up! Please use Component#clearTimeout or Component#dispose instead.
Parameters:
Name | Type | Description |
---|---|---|
fn | Component~GenericCallback | The function that will be run after |
timeout | number | Timeout in milliseconds to delay before executing the specified function. |
Listens to Events:
Returns:
number -
Returns a timeout ID that gets used to identify the timeout. It can also get used in Component#clearTimeout to clear the timeout that was set.
Overrides:
See:
show()
[component.js](https://docs.videojs.com/component.js.html)
, [line 846](https://docs.videojs.com/component.js.html#line846)
Show the Component
s element if it is hidden by removing the ‘vjs-hidden’ class name from it.
Overrides:
src(sourceopt) → {string|undefined}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3456](https://docs.videojs.com/player.js.html#line3456)
Get or set the video source.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
source | Tech~SourceObject | Array.<Tech~SourceObject> | string | <optional> | A SourceObject, an array of SourceObjects, or a string referencing a URL to a media source. It is highly recommended that an object or array of objects is used here, so that source selection algorithms can take the
|
Returns:
string | undefined -
If the source
argument is missing, returns the current source URL. Otherwise, returns nothing/undefined.
supportsFullScreen() → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2765](https://docs.videojs.com/player.js.html#line2765)
Check if current tech can support native fullscreen (e.g. with built in controls like iOS)
Returns:
boolean -
if native fullscreen is supported
tech(safetyopt) → {Tech}
[player.js](https://docs.videojs.com/player.js.html)
, [line 1286](https://docs.videojs.com/player.js.html#line1286)
Return a reference to the current Tech. It will print a warning by default about the danger of using the tech directly but any argument that is passed in will silence the warning.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
safety | * | <optional> | Anything passed in to silence the warning |
Returns:
Tech -
The Tech
textTracks() → {TextTrackList}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4930](https://docs.videojs.com/player.js.html#line4930)
Get the TextTrackList
Returns:
the current text track list
toggleClass(classToToggle, predicateopt)
[component.js](https://docs.videojs.com/component.js.html)
, [line 838](https://docs.videojs.com/component.js.html#line838)
Add or remove a CSS class name from the component’s element.
classToToggle
gets added when Component#hasClass would return false.classToToggle
gets removed when Component#hasClass would return true.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
classToToggle | string | The class to add or remove based on (@link Component#hasClass} | |
predicate | boolean | Dom~predicate | <optional> | An Dom~predicate function or a boolean |
Overrides:
toJSON() → {Object}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4420](https://docs.videojs.com/player.js.html#line4420)
returns a JavaScript object reperesenting the current track information. DOES not return it as JSON
Returns:
Object -
Object representing the current of track info
triggerReady()
[component.js](https://docs.videojs.com/component.js.html)
, [line 722](https://docs.videojs.com/component.js.html#line722)
Trigger all the ready listeners for this Component
.
Fires:
Overrides:
updateSourceCaches_(srcObj)
[player.js](https://docs.videojs.com/player.js.html)
, [line 1492](https://docs.videojs.com/player.js.html#line1492)
Update the internal source caches so that we return the correct source from src()
, currentSource()
, and currentSources()
.
Note:
currentSources
will not be updated if the source that is passed in exists in the currentcurrentSources
cache.
Parameters:
Name | Type | Description |
---|---|---|
srcObj | Tech~SourceObject | A string or object source to update our caches to. |
userActive(boolopt) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4020](https://docs.videojs.com/player.js.html#line4020)
Get/set if user is active
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bool | boolean | <optional> |
|
Fires:
Returns:
boolean -
The current value of userActive when getting
usingNativeControls(boolopt) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 3898](https://docs.videojs.com/player.js.html#line3898)
Toggle native controls on/off. Native controls are the controls built into devices (e.g. default iPhone controls) or other techs (e.g. Vimeo Controls) This should only be set by the current tech, because only the tech knows if it can support native controls
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bool | boolean | <optional> |
|
Fires:
Returns:
boolean -
The current value of native controls when getting
usingPlugin(name) → {boolean}
[player.js](https://docs.videojs.com/player.js.html)
, [line 5184](https://docs.videojs.com/player.js.html#line5184)
Reports whether or not a player is using a plugin by name.
For basic plugins, this only reports whether the plugin has ever been initialized on this player.
Parameters:
Name | Type | Description |
---|---|---|
name | string | The name of a plugin. |
Returns:
boolean -
Whether or not this player is using the requested plugin.
videoHeight() → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4359](https://docs.videojs.com/player.js.html#line4359)
Get video height
Returns:
number -
current video height
videoTracks() → {VideoTrackList}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4910](https://docs.videojs.com/player.js.html#line4910)
Get the VideoTrackList
Returns:
the current video track list
videoWidth() → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 4349](https://docs.videojs.com/player.js.html#line4349)
Get video width
Returns:
number -
current video width
volume(percentAsDecimalopt) → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 2663](https://docs.videojs.com/player.js.html#line2663)
Get or set the current volume of the media
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
percentAsDecimal | number | <optional> | The new volume as a decimal percent: - 0 is muted/0%/off - 1.0 is 100%/full - 0.5 is half volume or 50% |
Returns:
number -
The current volume as a percent when getting
width(valueopt) → {number}
[player.js](https://docs.videojs.com/player.js.html)
, [line 849](https://docs.videojs.com/player.js.html#line849)
A getter/setter for the Player
‘s width. Returns the player’s configured value. To get the current width use currentWidth()
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value | number | <optional> | The value to set the |
Returns:
number -
The current width of the Player
when getting.
Overrides:
Type Definitions
MediaObject
[player.js](https://docs.videojs.com/player.js.html)
, [line 4642](https://docs.videojs.com/player.js.html#line4642)
An object that describes a single piece of media.
Properties that are not part of this type description will be retained; so, this can be viewed as a generic metadata storage mechanism as well.
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
album | string | <optional> | Unused, except if this object is passed to the |
artist | string | <optional> | Unused, except if this object is passed to the |
artwork | Array.<Object> | <optional> | Unused, except if this object is passed to the |
poster | string | <optional> | URL to an image that will display before playback. |
src | Tech~SourceObject | Array.<Tech~SourceObject> | string | <optional> | A single source object, an array of source objects, or a string referencing a URL to a media source. It is highly recommended that an object or array of objects is used here, so that source selection algorithms can take the |
title | string | <optional> | Unused, except if this object is passed to the |
textTracks | Array.<Object> | <optional> | An array of objects to be used to create text tracks, following the native track element format. For ease of removal, these will be created as “remote” text tracks and set to automatically clean up on source changes.
|
Events
beforepluginsetup:$name
[plugin.js](https://docs.videojs.com/plugin.js.html)
, [line 488](https://docs.videojs.com/plugin.js.html#line488)
Signals that a plugin is about to be set up on a player - by name. The name is the name of the plugin.
Type:
abort
[player.js](https://docs.videojs.com/player.js.html)
, [line 75](https://docs.videojs.com/player.js.html#line75)
Fires when the loading of an audio/video is aborted.
Type:
beforepluginsetup
[plugin.js](https://docs.videojs.com/plugin.js.html)
, [line 481](https://docs.videojs.com/plugin.js.html#line481)
Signals that a plugin is about to be set up on a player.
Type:
canplay
[player.js](https://docs.videojs.com/player.js.html)
, [line 1751](https://docs.videojs.com/player.js.html#line1751)
The media has a readyState of HAVE_FUTURE_DATA or greater.
Type:
canplaythrough
[player.js](https://docs.videojs.com/player.js.html)
, [line 1769](https://docs.videojs.com/player.js.html#line1769)
The media has a readyState of HAVE_ENOUGH_DATA or greater. This means that the entire media file can be played without buffering.
Type:
componentresize
[component.js](https://docs.videojs.com/component.js.html)
, [line 1021](https://docs.videojs.com/component.js.html#line1021)
Triggered when a component is resized.
Type:
Overrides:
controlsdisabled
[player.js](https://docs.videojs.com/player.js.html)
, [line 3870](https://docs.videojs.com/player.js.html#line3870)
Type:
controlsenabled
[player.js](https://docs.videojs.com/player.js.html)
, [line 3859](https://docs.videojs.com/player.js.html#line3859)
Type:
dispose
[player.js](https://docs.videojs.com/player.js.html)
, [line 586](https://docs.videojs.com/player.js.html#line586)
Called when the player is being disposed of.
Type:
Listeners of This Event:
Overrides:
durationchange
[player.js](https://docs.videojs.com/player.js.html)
, [line 2566](https://docs.videojs.com/player.js.html#line2566)
Type:
Listeners of This Event:
emptied
[player.js](https://docs.videojs.com/player.js.html)
, [line 107](https://docs.videojs.com/player.js.html#line107)
Fires when the current playlist is empty.
Type:
ended
[player.js](https://docs.videojs.com/player.js.html)
, [line 1899](https://docs.videojs.com/player.js.html#line1899)
Fired when the end of the media resource is reached (currentTime == duration)
Type:
Listeners of This Event:
enterFullWindow
[player.js](https://docs.videojs.com/player.js.html)
, [line 2972](https://docs.videojs.com/player.js.html#line2972)
Type:
enterpictureinpicture
[player.js](https://docs.videojs.com/player.js.html)
, [line 3073](https://docs.videojs.com/player.js.html#line3073)
This event fires when the player enters picture in picture mode
Type:
Listeners of This Event:
error
[player.js](https://docs.videojs.com/player.js.html)
, [line 3988](https://docs.videojs.com/player.js.html#line3988)
Type:
exitFullWindow
[player.js](https://docs.videojs.com/player.js.html)
, [line 3016](https://docs.videojs.com/player.js.html#line3016)
Type:
firstplay
[player.js](https://docs.videojs.com/player.js.html)
, [line 1852](https://docs.videojs.com/player.js.html#line1852)
Fired the first time a video is played. Not part of the HLS spec, and this is probably not the best implementation yet, so use sparingly. If you don’t have a reason to prevent playback, use myPlayer.one('play');
instead.
Type:
Deprecated:
- As of 6.0 firstplay event is deprecated.
fullscreenchange
[player.js](https://docs.videojs.com/player.js.html)
, [line 2794](https://docs.videojs.com/player.js.html#line2794)
Type:
Listeners of This Event:
languagechange
[player.js](https://docs.videojs.com/player.js.html)
, [line 4390](https://docs.videojs.com/player.js.html#line4390)
fires when the player language change
Type:
leavepictureinpicture
[player.js](https://docs.videojs.com/player.js.html)
, [line 3095](https://docs.videojs.com/player.js.html#line3095)
This event fires when the player leaves picture in picture mode
Type:
Listeners of This Event:
loadeddata
[player.js](https://docs.videojs.com/player.js.html)
, [line 154](https://docs.videojs.com/player.js.html#line154)
Fires when the browser has loaded the current frame of the audio/video.
Type:
- event
loadeddata
[player.js](https://docs.videojs.com/player.js.html)
, [line 5147](https://docs.videojs.com/player.js.html#line5147)
Fired when the player has downloaded data at the current playback position
Type:
loadedmetadata
[player.js](https://docs.videojs.com/player.js.html)
, [line 138](https://docs.videojs.com/player.js.html#line138)
Fires when the browser has loaded meta data for the audio/video.
Type:
Listeners of This Event:
loadedmetadata
[player.js](https://docs.videojs.com/player.js.html)
, [line 5140](https://docs.videojs.com/player.js.html#line5140)
Fired when the player has initial duration and dimension information
Type:
loadstart
[player.js](https://docs.videojs.com/player.js.html)
, [line 1403](https://docs.videojs.com/player.js.html#line1403)
Fired when the user agent begins looking for media data
Type:
Listeners of This Event:
- MuteToggle#update
- PlaybackRateMenuButton#updateVisibility
- TextTrackDisplay#preselectTrack
- TextTrackDisplay#toggleDisplay
pause
[player.js](https://docs.videojs.com/player.js.html)
, [line 1874](https://docs.videojs.com/player.js.html#line1874)
Fired whenever the media has been paused
Type:
Listeners of This Event:
play
[player.js](https://docs.videojs.com/player.js.html)
, [line 1675](https://docs.videojs.com/player.js.html#line1675)
Triggered whenever an Tech#play event happens. Indicates that playback has started or resumed.
Type:
Listeners of This Event:
playbackrateschange
[player.js](https://docs.videojs.com/player.js.html)
, [line 4900](https://docs.videojs.com/player.js.html#line4900)
fires when the playback rates in a player are changed
Type:
Listeners of This Event:
playerresize
[resize-manager.js](https://docs.videojs.com/resize-manager.js.html)
, [line 107](https://docs.videojs.com/resize-manager.js.html#line107)
Called when the player size has changed
Type:
playing
[player.js](https://docs.videojs.com/player.js.html)
, [line 1788](https://docs.videojs.com/player.js.html#line1788)
The media is no longer blocked from playback, and has started playing.
Type:
pluginsetup
[plugin.js](https://docs.videojs.com/plugin.js.html)
, [line 496](https://docs.videojs.com/plugin.js.html#line496)
Signals that a plugin has just been set up on a player.
Type:
posterchange
[player.js](https://docs.videojs.com/player.js.html)
, [line 3791](https://docs.videojs.com/player.js.html#line3791)
This event fires when the poster image is changed on the player.
Type:
Listeners of This Event:
progress
[player.js](https://docs.videojs.com/player.js.html)
, [line 59](https://docs.videojs.com/player.js.html#line59)
Fired while the user agent is downloading media data.
Type:
Listeners of This Event:
ratechange
[player.js](https://docs.videojs.com/player.js.html)
, [line 1702](https://docs.videojs.com/player.js.html#line1702)
Fires when the playing speed of the audio/video is changed
Type:
- event
Listeners of This Event:
ready
[component.js](https://docs.videojs.com/component.js.html)
, [line 739](https://docs.videojs.com/component.js.html#line739)
Triggered when a Component
is ready.
Type:
Overrides:
resize
[player.js](https://docs.videojs.com/player.js.html)
, [line 186](https://docs.videojs.com/player.js.html#line186)
Fires when the video’s intrinsic dimensions change
Type:
- event
seeked
[player.js](https://docs.videojs.com/player.js.html)
, [line 1825](https://docs.videojs.com/player.js.html#line1825)
Fired when the player has finished jumping to a new time
Type:
Listeners of This Event:
seeking
[player.js](https://docs.videojs.com/player.js.html)
, [line 1806](https://docs.videojs.com/player.js.html#line1806)
Fired whenever the player is jumping to a new time
Type:
sourceset
[player.js](https://docs.videojs.com/player.js.html)
, [line 1544](https://docs.videojs.com/player.js.html#line1544)
EXPERIMENTAL Fired when the source is set or changed on the Tech causing the media element to reload.
It will fire for the initial source and each subsequent source. This event is a custom event from Video.js and is triggered by the Tech.
The event object for this event contains a src
property that will contain the source that was available when the event was triggered. This is generally only necessary if Video.js is switching techs while the source was being changed.
It is also fired when load
is called on the player (or media element) because the specification for load
says that the resource selection algorithm needs to be aborted and restarted. In this case, it is very likely that the src
property will be set to the empty string ""
to indicate we do not know what the source will be but that it is changing.
This event is currently still experimental and may change in minor releases. To use this, pass enableSourceset
option to the player.
Type:
Properties:
Name | Type | Description |
---|---|---|
src | string | The source url available when the |
stalled
[player.js](https://docs.videojs.com/player.js.html)
, [line 122](https://docs.videojs.com/player.js.html#line122)
Fires when the browser is trying to get media data, but data is not available.
Type:
suspend
[player.js](https://docs.videojs.com/player.js.html)
, [line 91](https://docs.videojs.com/player.js.html#line91)
Fires when the browser is intentionally not getting media data.
Type:
tap
[component.js](https://docs.videojs.com/component.js.html)
, [line 1269](https://docs.videojs.com/component.js.html#line1269)
Triggered when a Component
is tapped.
Type:
Overrides:
textdata
[player.js](https://docs.videojs.com/player.js.html)
, [line 2183](https://docs.videojs.com/player.js.html#line2183)
Fires when we get a textdata event from tech
Type:
texttrackchange
[player.js](https://docs.videojs.com/player.js.html)
, [line 218](https://docs.videojs.com/player.js.html#line218)
Fires when the text track has been changed
Type:
- event
Listeners of This Event:
timeupdate
[player.js](https://docs.videojs.com/player.js.html)
, [line 170](https://docs.videojs.com/player.js.html#line170)
Fires when the current playback position has changed.
Type:
- event
Listeners of This Event:
- CurrentTimeDisplay#updateContent
- DurationDisplay#updateContent
- RemainingTimeDisplay#updateContent
- SeekBar#update
- TimeDisplay#updateContent
timeupdate
[player.js](https://docs.videojs.com/player.js.html)
, [line 5154](https://docs.videojs.com/player.js.html#line5154)
Fired when the current playback position has changed * During playback this is fired every 15-250 milliseconds, depending on the playback technology in use.
Type:
useractive
[player.js](https://docs.videojs.com/player.js.html)
, [line 4037](https://docs.videojs.com/player.js.html#line4037)
Type:
userinactive
[player.js](https://docs.videojs.com/player.js.html)
, [line 4063](https://docs.videojs.com/player.js.html#line4063)
Type:
usingcustomcontrols
[player.js](https://docs.videojs.com/player.js.html)
, [line 3925](https://docs.videojs.com/player.js.html#line3925)
player is using the custom HTML controls
Type:
usingnativecontrols
[player.js](https://docs.videojs.com/player.js.html)
, [line 3915](https://docs.videojs.com/player.js.html#line3915)
player is using the native device controls
Type:
volumechange
[player.js](https://docs.videojs.com/player.js.html)
, [line 202](https://docs.videojs.com/player.js.html#line202)
Fires when the volume has been changed
Type:
- event
Listeners of This Event:
volumechange
[player.js](https://docs.videojs.com/player.js.html)
, [line 5163](https://docs.videojs.com/player.js.html#line5163)
Fired when the volume changes
Type:
waiting
[player.js](https://docs.videojs.com/player.js.html)
, [line 1720](https://docs.videojs.com/player.js.html#line1720)
A readyState change on the DOM element has caused playback to stop.
Type:
pluginsetup:$name
[plugin.js](https://docs.videojs.com/plugin.js.html)
, [line 503](https://docs.videojs.com/plugin.js.html#line503)
Signals that a plugin has just been set up on a player - by name. The name is the name of the plugin.