Player

An instance of the Player class is created when any of the Video.js setup methods are used to initialize a video.

After an instance has been created it can be accessed globally in three ways:

  1. By calling videojs.getPlayer('example_video_1');
  2. By calling videojs('example_video_1'); (not recommended)
  3. By using it directly via videojs.players.example_video_1;

Constructor

new Player(tag, optionsopt, readyopt)

Create an instance of this class.

Parameters:
NameTypeAttributesDescription
tagElement

The original video DOM element used for configuring options.

optionsObject<optional>

Object of option names and values.

readyPlayerReadyCallback<optional>

Ready callback function.

Extends

Members

controls_ :boolean

Type:
  • boolean

crossorigin

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.

poster_ :string

Type:
  • string

(static) players :Object

Global enumeration of players.

The keys are the player IDs and the values are either the Player instance or null for disposed players.

Type:
  • Object

Methods

$(selector, contextopt) → {Element|null}

Find a single DOM element matching a selector. This can be within the Components contentEl() or another custom context.

Parameters:
NameTypeAttributesDefaultDescription
selectorstring

A valid CSS selector, which will be passed to querySelector.

contextElement | 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 this.contentEl() gets used. If this.contentEl() returns nothing it falls back to document.

Overrides
Returns:

the dom element that was found, or null

Type: 
Element | null

$$(selector, contextopt) → {NodeList}

Finds all DOM element matching a selector. This can be within the Components contentEl() or another custom context.

Parameters:
NameTypeAttributesDefaultDescription
selectorstring

A valid CSS selector, which will be passed to querySelectorAll.

contextElement | 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 this.contentEl() gets used. If this.contentEl() returns nothing it falls back to document.

Overrides
Returns:

a list of dom elements that were found

Type: 
NodeList

addChild(child, optionsopt, indexopt) → {Component}

Add a child Component inside the current Component.

Parameters:
NameTypeAttributesDefaultDescription
childstring | Component

The name or instance of a child to add.

optionsObject<optional>
{}

The key/value store of options that will get passed to children of the child.

indexnumber<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.

Type: 
Component

addClass(…classesToAdd)

Add a CSS class name to the Components element.

Parameters:
NameTypeAttributesDescription
classesToAddstring<repeatable>

One or more CSS class name to add.

addRemoteTextTrack(options, manualCleanupopt) → {HtmlTrackElement}

Create a remote TextTrack and an HTMLTrackElement.

Parameters:
NameTypeAttributesDefaultDescription
optionsObject

Options to pass to HTMLTrackElement during creation. See HTMLTrackElement for object properties that you should use.

manualCleanupboolean<optional>
false

if set to true, the TextTrack will not be removed from the TextTrackList and HtmlTrackElementList after a source change

Returns:

the HTMLTrackElement that was created and added to the HtmlTrackElementList and the remote TextTrackList

Type: 
HtmlTrackElement

addTextTrack(kindopt, labelopt, languageopt) → {TextTrack|undefined}

A helper method for adding a TextTrack to our TextTrackList.

In addition to the W3C settings we allow adding additional info through options.

Parameters:
NameTypeAttributesDescription
kindstring<optional>

the kind of TextTrack you are adding

labelstring<optional>

the label to give the TextTrack label

languagestring<optional>

the language to set on the TextTrack

Returns:

the TextTrack that was added or undefined if there is no tech

Type: 
TextTrack | undefined

any(type, fn)

This function will add an event listener that gets triggered only once and is removed from all events. This is like adding an array of event listeners with EventTarget#on that calls EventTarget#off on all events the first time it is triggered.

Parameters:
NameTypeDescription
typestring | Array.<string>

An event name or an array of event names.

fnfunction

The function to be called once for each event name.

Overrides

aspectRatio(ratioopt) → {string|undefined}

A getter/setter for the Player's aspect ratio.

Parameters:
NameTypeAttributesDescription
ratiostring<optional>

The value to set the Player's aspect ratio to.

Returns:
  • The current aspect ratio of the Player when getting. - undefined when setting
Type: 
string | undefined

audioOnlyMode(valueopt) → {Promise|boolean}

Get the current audioOnlyMode state or set audioOnlyMode to true or false.

Setting this to true will hide all player components except the control bar, as well as control bar components needed only for video.

Parameters:
NameTypeAttributesDescription
valueboolean<optional>

The value to set audioOnlyMode to.

Returns:

A Promise is returned when setting the state, and a boolean when getting the present state

Type: 
Promise | boolean

audioPosterMode(valueopt) → {Promise|boolean}

Get the current audioPosterMode state or set audioPosterMode to true or false

Parameters:
NameTypeAttributesDescription
valueboolean<optional>

The value to set audioPosterMode to.

Returns:

A Promise is returned when setting the state, and a boolean when getting the present state

Type: 
Promise | boolean

audioTracks() → {AudioTrackList}

Returns:

the current audio track list

Type: 
AudioTrackList

autoplay(valueopt) → {boolean|string|undefined}

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:
NameTypeAttributesDescription
valueboolean | 'play' | 'muted' | 'any'<optional>
  • true: autoplay using the browser behavior - false: do not autoplay - 'play': call play() on every loadstart - 'muted': call muted() then play() on every loadstart - 'any': call play() on every loadstart. if that fails call muted() then play(). - *: values other than those listed here will be set autoplay to true
Returns:
  • The current value of autoplay when getting - Nothing when setting
Type: 
boolean | string | undefined

blur()

Remove the focus from this component

breakpoints(breakpointsopt) → {Object}

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:
NameTypeAttributesDescription
breakpointsObject | boolean<optional>

If an object is given, it can be used to provide custom breakpoints. If true is given, will set default breakpoints. If this argument is not given, will simply return the current breakpoints.

Properties
NameTypeAttributesDescription
tinynumber<optional>

The maximum width for the "vjs-layout-tiny" class.

xsmallnumber<optional>

The maximum width for the "vjs-layout-x-small" class.

smallnumber<optional>

The maximum width for the "vjs-layout-small" class.

mediumnumber<optional>

The maximum width for the "vjs-layout-medium" class.

largenumber<optional>

The maximum width for the "vjs-layout-large" class.

xlargenumber<optional>

The maximum width for the "vjs-layout-x-large" class.

hugenumber<optional>

The maximum width for the "vjs-layout-huge" class.

Returns:

An object mapping breakpoint names to maximum width values.

Type: 
Object

buffered() → {TimeRange}

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:

A mock TimeRanges object (following HTML spec)

Type: 
TimeRange

bufferedEnd() → {number}

Get the ending time of the last buffered time range This is used in the progress bar to encapsulate all time ranges.

Returns:

The end of the last buffered time range

Type: 
number

bufferedPercent() → {number}

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:

A decimal between 0 and 1 representing the percent that is buffered 0 being 0% and 1 being 100%

Type: 
number

(abstract) buildCSSClass() → {string}

Builds the default DOM class name. Should be overridden by sub-components.

Returns:

The DOM class name for this object.

Type: 
string

canPlayType(type) → {string}

Check whether the player can play a given mimetype

Parameters:
NameTypeDescription
typestring

The mimetype to check

Returns:

'probably', 'maybe', or '' (empty string)

Type: 
string

cancelAnimationFrame(id) → {number}

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:
NameTypeDescription
idnumber

The rAF ID to clear. The return value of Component#requestAnimationFrame.

Returns:

Returns the rAF ID that was cleared.

Type: 
number

cancelNamedAnimationFrame(name)

Cancels a current named animation frame if it exists.

Parameters:
NameTypeDescription
namestring

The name of the requestAnimationFrame to cancel.

children() → {Array}

Get an array of all child components

Returns:

The children

Type: 
Array

clearInterval(intervalId) → {number}

Clears an interval that gets created via window.setInterval or Component#setInterval. If you set an interval 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:
NameTypeDescription
intervalIdnumber

The id of the interval to clear. The return value of Component#setInterval or window.setInterval.

Returns:

Returns the interval id that was cleared.

Type: 
number

clearTimeout(timeoutId) → {number}

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:
NameTypeDescription
timeoutIdnumber

The id of the timeout to clear. The return value of Component#setTimeout or window.setTimeout.

Returns:

Returns the timeout id that was cleared.

Type: 
number

contentEl() → {Element}

Return the Components DOM element. This is where children get inserted. This will usually be the the same as the element returned in Component#el.

Returns:

The content element for this Component.

Type: 
Element

controls(boolopt) → {boolean|undefined}

Get or set whether or not the controls are showing.

Parameters:
NameTypeAttributesDescription
boolboolean<optional>
  • true to turn controls on - false to turn controls off
Returns:
  • The current value of controls when getting - Nothing when setting
Type: 
boolean | undefined

createEl() → {Element}

Create the Player's DOM element.

Returns:

The DOM element that gets created.

Type: 
Element

createModal(content, optionsopt) → {ModalDialog}

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:
NameTypeAttributesDescription
contentstring | 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.

optionsObject<optional>

Extra options which will be passed on to the ModalDialog.

Returns:

the ModalDialog that was created

Type: 
ModalDialog

crossOrigin(valueopt) → {string|null|undefined}

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:
NameTypeAttributesDescription
valuestring | null<optional>

The value to set the Player's crossOrigin to. If an argument is given, must be one of 'anonymous' or 'use-credentials', or 'null'.

Returns:
  • The current crossOrigin value of the Player when getting. - undefined when setting
Type: 
string | null | undefined

currentBreakpoint() → {string}

Get current breakpoint name, if any.

Returns:

If there is currently a breakpoint set, returns a the key from the breakpoints object matching it. Otherwise, returns an empty string.

Type: 
string

currentBreakpointClass() → {string}

Get the current breakpoint class name.

Returns:

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.

Type: 
string

currentDimension(widthOrHeight) → {number}

Get the computed width or the height of the component's element.

Uses window.getComputedStyle.

Parameters:
NameTypeDescription
widthOrHeightstring

A string containing 'width' or 'height'. Whichever one you want to get.

Returns:

The dimension that gets asked for or 0 if nothing was set for that dimension.

Type: 
number

currentDimensions() → {Component~DimensionObject}

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.

Type: 
Component~DimensionObject

currentHeight() → {number}

Get the computed height of the component's element.

Uses window.getComputedStyle.

Returns:

The computed height of the component's element.

Type: 
number

currentSource() → {Tech~SourceObject}

Returns the current source object.

Returns:

The current source object

Type: 
Tech~SourceObject

currentSources() → {Array.<Tech~SourceObject>}

Returns all of the current source objects.

Returns:

The current source objects

Type: 
Array.<Tech~SourceObject>

currentSrc() → {string}

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:

The current source

Type: 
string

currentTime(secondsopt) → {number|undefined}

Get or set the current time (in seconds)

Parameters:
NameTypeAttributesDescription
secondsnumber | string<optional>

The time to seek to in seconds

Returns:
  • the current time in seconds when getting - Nothing when setting
Type: 
number | undefined

currentType() → {string}

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:

The source MIME type

Type: 
string

currentWidth() → {number}

Get the computed width of the component's element.

Uses window.getComputedStyle.

Returns:

The computed width of the component's element.

Type: 
number

debug(enabled) → {boolean|undefined}

Set debug mode to enable/disable logs at info level.

Parameters:
NameTypeDescription
enabledboolean
Fires:
  • Player#event:debugon
  • Player#event:debugoff
Returns:
Type: 
boolean | undefined

defaultMuted(defaultMutedopt) → {boolean|undefined}

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:
NameTypeAttributesDescription
defaultMutedboolean<optional>
  • true to mute - false to unmute
Returns:
  • true if defaultMuted is on and getting - false if defaultMuted is off and getting - Nothing when setting
Type: 
boolean | undefined

defaultPlaybackRate(rateopt) → {number|undefined}

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:
NameTypeAttributesDescription
ratenumber<optional>

New default playback rate to set.

Returns:
  • The default playback rate when getting or 1.0 - Nothing when setting
Type: 
number | undefined

dimension(dimension, valueopt) → {number}

A getter/setter for the Player's width & height.

Parameters:
NameTypeAttributesDescription
dimensionstring

This string can be: - 'width' - 'height'

valuenumber | string<optional>

Value for dimension specified in the first argument.

Returns:

The dimension arguments value when getting (width/height).

Type: 
number

dimensions(width, height)

Set both the width and height of the Component element at the same time.

Parameters:
NameTypeDescription
widthnumber | string

Width to set the Components element to.

heightnumber | string

Height to set the Components element to.

disablePictureInPicture(valueopt)

Get or set disable Picture-in-Picture mode.

Parameters:
NameTypeAttributesDescription
valueboolean<optional>
  • true will disable Picture-in-Picture mode - false will enable Picture-in-Picture mode

dispose()

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.

documentFullscreenChange_()

when the document fschange event triggers it calls this

duration(secondsopt) → {number|undefined}

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:
NameTypeAttributesDescription
secondsnumber<optional>

The duration of the video to set in seconds

Returns:
  • The duration of the video in seconds when getting - Nothing when setting
Type: 
number | undefined

el() → {Element}

Get the Components DOM element

Overrides
Returns:

The DOM element for this Component.

Type: 
Element

(protected) emitTapEvents()

Emit a 'tap' events when touch event support gets detected. This gets used to support toggling the controls through a tap on the video. They get enabled because every sub-component would have extra overhead otherwise.

Listens to Events:
  • Component#event:touchstart
  • Component#event:touchmove
  • Component#event:touchleave
  • Component#event:touchcancel
  • Component#event:touchend

enableTouchActivity()

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

ended() → {boolean}

Returns whether the player is in the "ended" state.

Returns:

True if the player is in the ended state, false if not.

Type: 
boolean

enterFullWindow()

When fullscreen isn't supported we can stretch the video container to as wide as the browser will let us.

error(erropt) → {MediaError|null|undefined}

Set or get the current MediaError

Parameters:
NameTypeAttributesDescription
errMediaError | string | number<optional>

A MediaError or a string/number to be turned into a MediaError

Returns:
  • The current MediaError when getting (or null) - Nothing when setting
Type: 
MediaError | null | undefined

exitFullWindow()

Exit full window

exitFullscreen()

Return the video to its normal size after having been in full screen mode

exitPictureInPicture() → {Promise}

Exit Picture-in-Picture mode.

See
Returns:

A promise.

Type: 
Promise

fill(boolopt) → {boolean|undefined}

A getter/setter/toggler for the vjs-fill className on the Player.

Turning this on will turn off fluid mode.

Parameters:
NameTypeAttributesDescription
boolboolean<optional>
  • A value of true adds the class. - A value of false removes the class. - No value will be a getter.
Returns:
  • The value of fluid when getting. - undefined when setting.
Type: 
boolean | undefined

fluid(boolopt) → {boolean|undefined}

A getter/setter/toggler for the vjs-fluid className on the Player.

Turning this on will turn off fill mode.

Parameters:
NameTypeAttributesDescription
boolboolean<optional>
  • A value of true adds the class. - A value of false removes the class. - No value will be a getter.
Returns:
  • The value of fluid when getting. - undefined when setting.
Type: 
boolean | undefined

focus()

Set the focus to this component

fullWindowOnEscKey(event)

Check for call to either exit full window or full screen on ESC key

Parameters:
NameTypeDescription
eventstring

Event to check for key press

getAttribute(attribute) → {string|null}

Get the value of an attribute on the Components element.

Parameters:
NameTypeDescription
attributestring

Name of the attribute to get the value from.

Returns:
  • 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 attribute does not exist or has no value.
Type: 
string | null

getCache() → {Object}

Get object for cached values.

Returns:

get the current object cache

Type: 
Object

getChild(name) → {Component|undefined}

Returns the child Component with the given name.

Parameters:
NameTypeDescription
namestring

The name of the child Component to get.

Returns:

The child Component with the given name or undefined.

Type: 
Component | undefined

getChildById(id) → {Component|undefined}

Returns the child Component with the given id.

Parameters:
NameTypeDescription
idstring

The id of the child Component to get.

Returns:

The child Component with the given id or undefined.

Type: 
Component | undefined

getDescendant(…names) → {Component|undefined}

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:
NameTypeAttributesDescription
names...Array.<string> | string<repeatable>

The name of the child Component to get.

Returns:

The descendant Component following the given descendant names or undefined.

Type: 
Component | undefined

getIsAvailableToBeFocused(el) → {boolean}

Determine whether or not this component is currently visible/enabled/etc...

Parameters:
NameTypeDescription
elHTMLElement

The HTML element representing the component.

Returns:

If the component can is currently visible & enabled, will be true. Otherwise, false.

Type: 
boolean

getIsFocusable(el) → {boolean}

Determine whether or not this component can be considered as focusable component.

Parameters:
NameTypeDescription
elHTMLElement

The HTML element representing the component.

Returns:

If the component can be focused, will be true. Otherwise, false.

Type: 
boolean

getMedia() → {Player~MediaObject}

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:
Type: 
Player~MediaObject

getPositions() → {Object}

Retrieves the position and size information of the component's element.

Returns:

An object with boundingClientRect and center properties. - boundingClientRect: An object with properties x, y, width, height, top, right, bottom, and left, representing the bounding rectangle of the element. - center: An object with properties x and y, representing the center point of the element. width and height are set to 0.

Type: 
Object

getVideoPlaybackQuality() → {Object|undefined}

Gets available media playback quality metrics as specified by the W3C's Media Playback Quality API.

See
Returns:

An object with supported media playback quality metrics or undefined if there is no tech or the tech does not support it.

Type: 
Object | undefined

handleHotkeys(event)

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:
NameTypeDescription
eventEvent

The keydown event that caused this function to be called.

handleKeyDown(event)

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:
NameTypeDescription
eventKeyboardEvent

The keydown event that caused this function to be called.

Listens to Events:
  • event:keydown

handleKeyPress(event)

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:
NameTypeDescription
eventKeyboardEvent

The event that caused this function to be called.

(abstract) handleLanguagechange()

Handles language change for the player in components. Should be overridden by sub-components.

handleSrc_(sourceopt, isRetryopt) → {string|undefined}

Executes source setting and getting logic

Parameters:
NameTypeAttributesDescription
sourceTech~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 type into account.

   If not provided, this method acts as a getter.
isRetryboolean<optional>

Indicates whether this is being called internally as a result of a retry

Returns:

If the source argument is missing, returns the current source URL. Otherwise, returns nothing/undefined.

Type: 
string | undefined

hasClass(classToCheck) → {boolean}

Check if a component's element has a CSS class name.

Parameters:
NameTypeDescription
classToCheckstring

CSS class name to check.

Returns:
  • True if the Component has the class. - False if the Component does not have the class`
Type: 
boolean

hasPlugin(name) → {boolean}

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:
NameTypeDescription
namestring

The name of a plugin.

Returns:

Whether or not this player has the requested plugin available.

Type: 
boolean

hasStarted(request) → {boolean}

Add/remove the vjs-has-started class

Parameters:
NameTypeDescription
requestboolean
  • true: adds the class - false: remove the class
Returns:

the boolean value of hasStarted_

Type: 
boolean

height(valueopt) → {number|undefined}

A getter/setter for the Player's height. Returns the player's configured value. To get the current height use currentheight().

Parameters:
NameTypeAttributesDescription
valuenumber | string<optional>

CSS value to set the Player's height to.

Returns:
  • The current height of the Player when getting. - Nothing when setting
Type: 
number | undefined

hide()

Hide the Components element if it is currently showing by adding the 'vjs-hidden` class name to it.

id() → {string}

Get this Components ID

Overrides
Returns:

The id of this Component

Type: 
string

initChildren()

Add and initialize default child Components based upon options.

isAudio(boolopt) → {boolean|undefined}

Gets or sets the audio flag

Parameters:
NameTypeAttributesDescription
boolboolean<optional>
  • true signals that this is an audio player - false signals that this is not an audio player
Returns:
  • The current value of isAudio when getting - Nothing when setting
Type: 
boolean | undefined

isDisposed() → {boolean}

Determine whether or not this component has been disposed.

Returns:

If the component has been disposed, will be true. Otherwise, false.

Type: 
boolean

isFullscreen(isFSopt) → {boolean|undefined}

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:
NameTypeAttributesDescription
isFSboolean<optional>

Set the players current fullscreen state

Returns:
  • true if fullscreen is on and getting - false if fullscreen is off and getting - Nothing when setting
Type: 
boolean | undefined

isInPictureInPicture(isPiPopt) → {boolean|undefined}

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:
NameTypeAttributesDescription
isPiPboolean<optional>

Set the players current Picture-in-Picture state

Returns:
  • true if Picture-in-Picture is on and getting - false if Picture-in-Picture is off and getting - nothing if setting
Type: 
boolean | undefined

language(codeopt) → {string|undefined}

Set or get the player's language code.

Changing the language will trigger languagechange which Components can use to update control text. ClickableComponent will update its control text by default on languagechange.

Parameters:
NameTypeAttributesDescription
codestring<optional>

the language code to set the player to

Returns:
  • The current language code when getting - Nothing when setting
Type: 
string | undefined

languages() → {Array}

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:

An array of of supported languages

Type: 
Array

load()

Begin loading the src data.

loadMedia(media, ready)

Populate the player using a MediaObject.

Parameters:
NameTypeDescription
mediaPlayer~MediaObject

A media object.

readyfunction

A callback to be called when the player is ready.

localize(string, tokensopt, defaultValueopt) → {string}

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:
NameTypeAttributesDescription
stringstring

The string to localize and the key to lookup in the language files.

tokensArray.<string><optional>

If the current item has token replacements, provide the tokens here.

defaultValuestring<optional>

Defaults to string. Can be a default value to use for token replacement if the lookup key is needed to be separate.

Returns:

The localized string or if no localization exists the english string.

Type: 
string

loop(valueopt) → {boolean|undefined}

Get or set the loop attribute on the video element.

Parameters:
NameTypeAttributesDescription
valueboolean<optional>
  • true means that we should loop the video - false means that we should not loop the video
Returns:
  • The current value of loop when getting - Nothing when setting
Type: 
boolean | undefined

manualAutoplay_()

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|undefined}

Get the current muted state, or turn mute on or off

Parameters:
NameTypeAttributesDescription
mutedboolean<optional>
  • true to mute - false to unmute
Returns:
  • true if mute is on and getting - false if mute is off and getting - nothing if setting
Type: 
boolean | undefined

name() → {string}

Get the Components name. The name gets used to reference the Component and is set during registration.

Returns:

The name of this Component.

Type: 
string

networkState() → {number}

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:

the current network activity state

Type: 
number

off(type, fnopt)

Removes an event listener for a specific event from an instance of EventTarget. This makes it so that the event listener will no longer get called when the named event happens.

Parameters:
NameTypeAttributesDescription
typestring | Array.<string>

An event name or an array of event names.

fnfunction<optional>

The function to remove. If not specified, all listeners managed by Video.js will be removed.

Overrides

on(type, fn)

Adds an event listener to an instance of an EventTarget. An event listener is a function that will get called when an event with a certain name gets triggered.

Parameters:
NameTypeDescription
typestring | Array.<string>

An event name or an array of event names.

fnfunction

The function to call with EventTargets

Overrides

one(type, fn)

This function will add an event listener that gets triggered only once. After the first trigger it will get removed. This is like adding an event listener with EventTarget#on that calls EventTarget#off on itself.

Parameters:
NameTypeDescription
typestring | Array.<string>

An event name or an array of event names.

fnfunction

The function to be called once for each event name.

Overrides

options(obj) → {Object}

Deep merge of options objects with new options.

Note: When both obj and options contain properties whose values are objects. The two properties get merged using module:obj.merge

Parameters:
NameTypeDescription
objObject

The object that contains new options.

Returns:

A new object of this.options_ and obj merged together.

Type: 
Object

pause()

Pause the video playback

paused() → {boolean}

Check if the player is paused or has yet to play

Returns:
  • false: if the media is currently playing - true: if media is not currently playing
Type: 
boolean

play() → {Promise|undefined}

Attempt to begin playback at the first opportunity.

Returns:

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.

Type: 
Promise | undefined

playbackRate(rateopt) → {number|undefined}

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:
NameTypeAttributesDescription
ratenumber<optional>

New playback rate to set.

Returns:
  • The current playback rate when getting or 1.0 - Nothing when setting
Type: 
number | undefined

playbackRates(newRatesopt) → {Array.<number>}

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:
NameTypeAttributesDescription
newRatesArray.<number><optional>

The new rates that the playback rates menu should update to. An empty array will hide the menu

Returns:

When used as a getter will return the current playback rates

Type: 
Array.<number>

played() → {TimeRange}

Get a TimeRange object representing the current ranges of time that the user has played.

Returns:

A time range object that represents all the increments of time that have been played.

Type: 
TimeRange

player() → {Player}

Return the Player that the Component has attached to.

Returns:

The player that this Component has attached to.

Type: 
Player

playsinline(valueopt) → {string|undefined}

Set or unset the playsinline attribute. Playsinline tells the browser that non-fullscreen playback is preferred.

Parameters:
NameTypeAttributesDescription
valueboolean<optional>
  • true means that we should try to play inline by default - false means that we should use the browser's default playback mode, which in most cases is inline. iOS Safari is a notable exception and plays fullscreen by default.
See
Returns:
  • the current value of playsinline - Nothing when setting
Type: 
string | undefined

poster(srcopt) → {string|undefined}

Get or set the poster image source url

Parameters:
NameTypeAttributesDescription
srcstring<optional>

Poster image source URL

Returns:
  • The current value of poster when getting - Nothing when setting
Type: 
string | undefined

preload(valueopt) → {string|undefined}

Get or set the preload attribute

Parameters:
NameTypeAttributesDescription
value'none' | 'auto' | 'metadata'<optional>

Preload mode to pass to tech

Returns:
  • The preload attribute value when getting - Nothing when setting
Type: 
string | undefined

ready(fn)

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.

Parameters:
NameTypeDescription
fnReadyCallback

Function that gets called when the Component is ready.

readyState() → {number}

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:

the current playback rendering state

Type: 
number

remainingTime() → {number}

Calculates how much time is left in the video. Not part of the native video API.

Returns:

The time remaining in seconds

Type: 
number

remainingTimeDisplay() → {number}

A remaining time function that is intended to be used when the time is to be displayed directly to the user.

Returns:

The rounded time remaining in seconds

Type: 
number

remoteTextTrackEls() → {HtmlTrackElementList}

Get the remote HtmlTrackElementList tracks.

Returns:

The current remote text track element list

Type: 
HtmlTrackElementList

remoteTextTracks() → {TextTrackList}

Get the remote TextTrackList

Returns:

The current remote text track list

Type: 
TextTrackList

removeAttribute(attribute)

Remove an attribute from the Components element.

Parameters:
NameTypeDescription
attributestring

Name of the attribute to remove.

removeChild(component)

Remove a child Component from this Components list of children. Also removes the child Components element from this Components element.

Parameters:
NameTypeDescription
componentComponent

The child Component to remove.

removeClass(…classesToRemove)

Remove a CSS class name from the Components element.

Parameters:
NameTypeAttributesDescription
classesToRemovestring<repeatable>

One or more CSS class name to remove.

removeRemoteTextTrack(track) → {undefined}

Remove a remote TextTrack from the respective TextTrackList and HtmlTrackElementList.

Parameters:
NameTypeDescription
trackObject

Remote TextTrack to remove

Returns:

does not return anything

Type: 
undefined

reportUserActivity(event)

Report user activity

Parameters:
NameTypeDescription
eventObject

Event object

requestAnimationFrame(fn) → {number}

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:
NameTypeDescription
fnComponent~GenericCallback

A function that will be bound to this component and executed just before the browser's next repaint.

Listens to Events:
Returns:

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.

Type: 
number

requestFullscreen(fullscreenOptionsopt)

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:
NameTypeAttributesDescription
fullscreenOptionsObject<optional>

Override the player fullscreen options

requestNamedAnimationFrame(name, fn)

Request an animation frame, but only one named animation frame will be queued. Another will never be added until the previous one finishes.

Parameters:
NameTypeDescription
namestring

The name to give this requestAnimationFrame

fnComponent~GenericCallback

A function that will be bound to this component and executed just before the browser's next repaint.

requestPictureInPicture() → {Promise}

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.

This can use document picture-in-picture or element picture in picture

Set enableDocumentPictureInPicture to true to use docPiP on a supported browser Else set disablePictureInPicture to false to disable elPiP on a supported browser

Returns:

A promise with a Picture-in-Picture window.

Type: 
Promise

reset()

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_()

Reset Control Bar's UI by calling sub-methods that reset all of Control Bar's components

resetPlaybackRate_()

Reset Playback ratio

resetProgressBar_()

Reset tech's progress so progress bar is reset in the UI

resetVolumeBar_()

Reset Volume bar

responsive(valueopt) → {boolean|undefined}

Get or set a flag indicating whether or not this player should adjust its UI based on its dimensions.

Parameters:
NameTypeAttributesDescription
valueboolean<optional>

Should be true if the player should adjust its UI based on its dimensions; otherwise, should be false.

Returns:

Will be true if this player should adjust its UI based on its dimensions; otherwise, will be false. Nothing if setting

Type: 
boolean | undefined

runPlayCallbacks_(val)

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:
NameTypeDescription
valundefined | Promise

The return value from the tech.

runPlayTerminatedQueue_()

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 differentiate between a terminated play and an actual call to play.

scrubbing(isScrubbingopt) → {boolean|undefined}

Sets or 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:
NameTypeAttributesDescription
isScrubbingboolean<optional>

whether the user is or is not scrubbing

Returns:
  • The value of scrubbing when getting - Nothing when setting
Type: 
boolean | undefined

seekable() → {TimeRange}

Get the TimeRanges of the media that are currently available for seeking to.

Returns:

A mock TimeRanges object (following HTML spec)

Type: 
TimeRange

seeking() → {boolean}

Returns whether the player is in the "seeking" state.

Returns:

True if the player is in the seeking state, false if not.

Type: 
boolean

selectSource(sources) → {Object|boolean}

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:
NameTypeDescription
sourcesArray

The sources for a media asset

Returns:

Object of source and tech order or false

Type: 
Object | boolean

setAttribute(attribute, value)

Set the value of an attribute on the Component's element

Parameters:
NameTypeDescription
attributestring

Name of the attribute to set.

valuestring

Value to set the attribute to.

setIcon(iconName, elopt) → {Element}

Adds an SVG icon element to another element or component.

Parameters:
NameTypeAttributesDefaultDescription
iconNamestring

The name of icon. A list of all the icon names can be found at 'sandbox/svg-icons.html'

elElement<optional>
this.el()

Element to set the title on. Defaults to the current Component's element.

Returns:

The newly created icon element.

Type: 
Element

setInterval(fn, interval) → {number}

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.

  1. It gets cleared via Component#clearInterval when Component#dispose gets called.
  2. The function callback will be a Component~GenericCallback
Parameters:
NameTypeDescription
fnComponent~GenericCallback

The function to run every x seconds.

intervalnumber

Execute the specified function every x milliseconds.

Listens to Events:
Returns:

Returns an id that can be used to identify the interval. It can also be be used in Component#clearInterval to clear the interval.

Type: 
number

setTimeout(fn, timeout) → {number}

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:

  1. It gets cleared via Component#clearTimeout when Component#dispose gets called.
  2. 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:
NameTypeDescription
fnComponent~GenericCallback

The function that will be run after timeout.

timeoutnumber

Timeout in milliseconds to delay before executing the specified function.

Listens to Events:
Returns:

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.

Type: 
number

show()

Show the Components element if it is hidden by removing the 'vjs-hidden' class name from it.

src(sourceopt) → {string|undefined}

Get or set the video source.

Parameters:
NameTypeAttributesDescription
sourceTech~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 type into account.

   If not provided, this method acts as a getter.
Returns:

If the source argument is missing, returns the current source URL. Otherwise, returns nothing/undefined.

Type: 
string | undefined

supportsFullScreen() → {boolean}

Check if current tech can support native fullscreen (e.g. with built in controls like iOS)

Returns:

if native fullscreen is supported

Type: 
boolean

tech(safetyopt) → {Tech}

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:
NameTypeAttributesDescription
safety*<optional>

Anything passed in to silence the warning

Returns:

The Tech

Type: 
Tech

textTracks() → {TextTrackList}

Returns:

the current text track list

Type: 
TextTrackList

toJSON() → {Object}

returns a JavaScript object representing the current track information. DOES not return it as JSON

Returns:

Object representing the current of track info

Type: 
Object

toggleClass(classToToggle, predicateopt)

Add or remove a CSS class name from the component's element.

Parameters:
NameTypeAttributesDescription
classToTogglestring

The class to add or remove based on (@link Component#hasClass}

predicateboolean | Dom~predicate<optional>

An Dom~predicate function or a boolean

trigger(event, hashopt)

This function causes an event to happen. This will then cause any event listeners that are waiting for that event, to get called. If there are no event listeners for an event then nothing will happen.

If the name of the Event that is being triggered is in EventTarget.allowedEvents_. Trigger will also call the on + uppercaseEventName function.

Example: 'click' is in EventTarget.allowedEvents_, so, trigger will attempt to call onClick if it exists.

Parameters:
NameTypeAttributesDescription
eventstring | Event | Object

The name of the event, an Event, or an object with a key of type set to an event name.

hashObject<optional>

Optionally extra argument to pass through to an event listener

triggerReady()

Trigger all the ready listeners for this Component.

updateSourceCaches_(srcObj)

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 current currentSources cache.

Parameters:
NameTypeDescription
srcObjTech~SourceObject

A string or object source to update our caches to.

userActive(boolopt) → {boolean|undefined}

Get/set if user is active

Parameters:
NameTypeAttributesDescription
boolboolean<optional>
  • true if the user is active - false if the user is inactive
Returns:
  • The current value of userActive when getting - Nothing when setting
Type: 
boolean | undefined

usingNativeControls(boolopt) → {boolean|undefined}

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:
NameTypeAttributesDescription
boolboolean<optional>
  • true to turn native controls on - false to turn native controls off
Returns:
  • The current value of native controls when getting - Nothing when setting
Type: 
boolean | undefined

usingPlugin(name) → {boolean}

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:
NameTypeDescription
namestring

The name of a plugin.

Returns:

Whether or not this player is using the requested plugin.

Type: 
boolean

version() → {PlayerVersion}

Returns an object with Video.js version.

Returns:

An object with Video.js version.

Type: 
PlayerVersion

videoHeight() → {number}

Get video height

Returns:

current video height

Type: 
number

videoTracks() → {VideoTrackList}

Returns:

the current video track list

Type: 
VideoTrackList

videoWidth() → {number}

Get video width

Returns:

current video width

Type: 
number

volume(percentAsDecimalopt) → {number|undefined}

Get or set the current volume of the media

Parameters:
NameTypeAttributesDescription
percentAsDecimalnumber<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:

The current volume as a percent when getting

Type: 
number | undefined

width(valueopt) → {number|undefined}

A getter/setter for the Player's width. Returns the player's configured value. To get the current width use currentWidth().

Parameters:
NameTypeAttributesDescription
valuenumber | string<optional>

CSS value to set the Player's width to.

Returns:
  • The current width of the Player when getting. - Nothing when setting
Type: 
number | undefined

(static) getTagSettings(tag) → {Object}

Gets tag settings

Parameters:
NameTypeDescription
tagElement

The player tag

Returns:

An object containing all of the settings for a player tag

Type: 
Object

Type Definitions

MediaObject

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.

Type:
  • Object
Properties
NameTypeAttributesDescription
albumstring<optional>

Unused, except if this object is passed to the MediaSession API.

artiststring<optional>

Unused, except if this object is passed to the MediaSession API.

artworkArray.<Object><optional>

Unused, except if this object is passed to the MediaSession API. If not specified, will be populated via the poster, if available.

posterstring<optional>

URL to an image that will display before playback.

srcTech~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 type into account.

titlestring<optional>

Unused, except if this object is passed to the MediaSession API.

textTracksArray.<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.

      These objects may have properties like `src`, `kind`, `label`,
      and `language`, see Tech#createRemoteTextTrack.

Events

beforepluginsetup:$name

Signals that a plugin is about to be set up on a player - by name. The name is the name of the plugin.

abort

Fires when the loading of an audio/video is aborted.

Type:

beforepluginsetup

Signals that a plugin is about to be set up on a player.

canplay

The media has a readyState of HAVE_FUTURE_DATA or greater.

Type:

canplaythrough

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

Triggered when a component is resized.

Type:

controlsdisabled

Type:

controlsenabled

Type:

dispose

Called when the player is being disposed of.

Type:
Listeners of This Event:

durationchange

Type:

emptied

Fires when the current playlist is empty.

Type:

ended

Fired when the end of the media resource is reached (currentTime == duration)

Type:
Listeners of This Event:

enterFullWindow

Type:

enterpictureinpicture

This event fires when the player enters picture in picture mode

Type:

error

Type:

exitFullWindow

Type:

fullscreenchange

Type:

languagechange

fires when the player language change

Type:

leavepictureinpicture

This event fires when the player leaves picture in picture mode

Type:

loadeddata

Fires when the browser has loaded the current frame of the audio/video.

Type:
  • event

loadeddata

Fired when the player has downloaded data at the current playback position

Type:

loadedmetadata

Fires when the browser has loaded meta data for the audio/video.

Type:
Listeners of This Event:

loadedmetadata

Fired when the player has initial duration and dimension information

Type:

loadstart

Fired when the user agent begins looking for media data

Type:

pause

Fired whenever the media has been paused

Type:
Listeners of This Event:

play

Triggered whenever an Tech#play event happens. Indicates that playback has started or resumed.

Type:
Listeners of This Event:

playbackrateschange

fires when the playback rates in a player are changed

Type:

playerresize

Called when the player size has changed

Type:

playing

The media is no longer blocked from playback, and has started playing.

Type:

pluginsetup

Signals that a plugin has just been set up on a player.

posterchange

This event fires when the poster image is changed on the player.

Type:
Listeners of This Event:

progress

Fired while the user agent is downloading media data.

Type:
Listeners of This Event:

ratechange

Fires when the playing speed of the audio/video is changed

Type:
  • event

ready

Triggered when a Component is ready.

Type:

resize

Fires when the video's intrinsic dimensions change

Type:
  • event

seeked

Fired when the player has finished jumping to a new time

Type:
Listeners of This Event:

seeking

Fired whenever the player is jumping to a new time

Type:

sourceset

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
NameTypeDescription
srcstring

The source url available when the sourceset was triggered. It will be an empty string if we cannot know what the source is but know that the source will change.

stalled

Fires when the browser is trying to get media data, but data is not available.

Type:

suspend

Fires when the browser is intentionally not getting media data.

Type:

tap

Triggered when a Component is tapped.

Type:
  • MouseEvent

textdata

Fires when we get a textdata event from tech

Type:

texttrackchange

Fires when the text track has been changed

Type:
  • event
Listeners of This Event:

timeupdate

Fires when the current playback position has changed.

Type:
  • event

timeupdate

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

Type:

userinactive

Type:

usingcustomcontrols

player is using the custom HTML controls

Type:

usingnativecontrols

player is using the native device controls

Type:

volumechange

Fires when the volume has been changed

Type:
  • event

volumechange

Fired when the volume changes

Type:

waiting

A readyState change on the DOM element has caused playback to stop.

Type:

pluginsetup:$name

Signals that a plugin has just been set up on a player - by name. The name is the name of the plugin.