Player

io.laminext.videojs.api.Player
trait Player extends Component

Attributes

See also:
Graph
Supertypes
trait Component
class Object
trait Any
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

def addRemoteTextTrack(options: Object): Unit

Add a remote text track

Add a remote text track

Attributes

options

Options for remote text track

def addTextTrack(kind: String, label: String, language: String): Unit

Add a text track In addition to the W3C settings we allow adding additional info through options. http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-addtexttrack

Add a text track In addition to the W3C settings we allow adding additional info through options. http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-addtexttrack

Attributes

kind

Captions, subtitles, chapters, descriptions, or metadata

label

Optional label

language

Optional language

def aspectRatio(ratio: String): String

Get/Set the aspect ratio

Get/Set the aspect ratio

Attributes

ratio

Aspect ratio for player

def autoplay(value: Boolean): Boolean

Get or set the autoplay attribute.

Get or set the autoplay attribute.

Attributes

value

Boolean to determine if video should autoplay

def buffered(): TimeRanges

Get a TimeRange object with the times of the video that have been downloaded If you just want the percent of the video that's been downloaded, use bufferedPercent.

Get a TimeRange object with the times of the video that have been downloaded If you just want the percent of the video that's been downloaded, use bufferedPercent.

Attributes

Returns:

TimeRange object

def bufferedPercent(): Double

Get the percent (as a decimal) of the video that's been downloaded. 0 means none, 1 means all. (This method isn't in the HTML5 spec, but it's very convenient)

Get the percent (as a decimal) of the video that's been downloaded. 0 means none, 1 means all. (This method isn't in the HTML5 spec, but it's very convenient)

Attributes

Returns:

The end of the last buffered time range

Example:
var howMuchIsDownloaded = myPlayer.bufferedPercent();
def canPlayType(`type`: String): Boolean

Check whether the player can play a given mimetype

Check whether the player can play a given mimetype

Attributes

`type`

The mimetype to check

def controls(bool: Boolean): Boolean

Get or set whether or not the controls are showing.

Get or set whether or not the controls are showing.

Attributes

bool

Set controls to showing or not

Returns:

Controls are showing

def createEl(): Element

Create the component's DOM element

Create the component's DOM element

Attributes

def currentSrc(): String

Returns the fully qualified URL of the current source value e.g. http://mysite.com/video.mp4 Can be used in conjuction with currentType to assist in rebuilding the current source object.

Returns the fully qualified URL of the current source value e.g. http://mysite.com/video.mp4 Can be used in conjuction with currentType to assist in rebuilding the current source object.

Attributes

def currentTime(): Double

Get the current time (in seconds)

Get the current time (in seconds)

Attributes

Returns:

The time in seconds, when not setting

Example:
var whereYouAt = myPlayer.currentTime();
def currentTime(seconds: Int | String): Player.this.type

Set the current time (in seconds)

Set the current time (in seconds)

Attributes

seconds

The time to seek to

Returns:

Self, when the current time is set

Example:
myPlayer.currentTime(120); // 2 minutes into the video
def 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.

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.

Attributes

def dimension(dimension: String, value: Int): Int

Get/set dimension for player

Get/set dimension for player

Attributes

dimension

Either width or height

value

Value for dimension

Returns:

Height when getting

def duration(seconds: Int): Int

Get the length in time of the video in seconds

Get the length in time of the video in seconds

Attributes

seconds

Duration when setting

Returns:

The duration of the video in seconds when getting

Note:

The video must have started loading before the duration can be known, and in the case of Flash, may not be known until the video starts playing.

def ended(): Boolean

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

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

Attributes

Returns:

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

def enterFullWindow(): Unit

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

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

Attributes

def error(err: MediaError | String | Int): Player.this.type

Set the current MediaError

Set the current MediaError

Attributes

err

A MediaError or a String/Number to be turned into a MediaError

Returns:

Player

def error(): MediaError

Get the current MediaError

Get the current MediaError

Attributes

Returns:

MediaError or null

def exitFullWindow(): Unit

Exit full window

Exit full window

Attributes

def exitFullscreen(): Unit

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

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

Attributes

def fluid(bool: Boolean): Unit

Add/remove the vjs-fluid class

Add/remove the vjs-fluid class

Attributes

bool

Value of true adds the class, value of false removes the class

def fullWindowOnEscKey(event: String): Unit

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

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

Attributes

event

Event to check for key press

def getCache(): Object

Get object for cached values.

Get object for cached values.

Attributes

def isFullscreen(): Boolean

Check if the player is in fullscreen mode

Check if the player is in fullscreen mode

Attributes

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.

def isFullscreen(isFS: Boolean): Player.this.type

Tell the player it's in fullscreen

Tell the player it's in fullscreen

Attributes

isFS

Update the player's fullscreen state

Returns:

Self

def language(): String

The player's language code

The player's language code

Attributes

Returns:

The locale string when getting

def language(code: String): Player.this.type

The player's language code

The player's language code

Attributes

code

The locale string

Returns:

Self when setting

Note:

The language should be set in the player options if you want the the controls to be built with a specific language. Changing the lanugage later will not update controls text.

def languages(): Array[String]

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

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

Attributes

Returns:

Array of languages

def load(): Player.this.type

Begin loading the src data.

Begin loading the src data.

Attributes

Returns:

Returns the player

def loop(): Boolean

Get the loop attribute on the video element.

Get the loop attribute on the video element.

Attributes

Returns:

The loop attribute value when getting

def loop(value: Boolean): Player.this.type

Set the loop attribute on the video element.

Set the loop attribute on the video element.

Attributes

value

Boolean to determine if video should loop

Returns:

Returns the player when setting

def muted(): Boolean

Get the current muted state

Get the current muted state

Attributes

def muted(value: Boolean): Player.this.type

Turn mute on or off

Turn mute on or off

Attributes

value

True to mute, false to unmute

Returns:

Returns the player when setting

def networkState(): Int

Returns the current state of network activity for the element, from the codes in the list below.

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.

Attributes

def pause(): Player.this.type

Pause the video playback

Pause the video playback

Attributes

def paused(): Boolean

Check if the player is paused

Check if the player is paused

Attributes

def play(): Player.this.type

Start media playback

Start media playback

Attributes

def playbackRate(rate: Double): Player.this.type

Sets the current playback rate. A playback rate of 1.0 represents normal speed and 0.5 would indicate half-speed playback, for instance.

Sets the current playback rate. A playback rate of 1.0 represents normal speed and 0.5 would indicate half-speed playback, for instance.

Attributes

rate

New playback rate to set.

def playbackRate(): Double

Gets the current playback rate. A playback rate of 1.0 represents normal speed and 0.5 would indicate half-speed playback, for instance.

Gets the current playback rate. A playback rate of 1.0 represents normal speed and 0.5 would indicate half-speed playback, for instance.

Attributes

def poster(src: String): Player.this.type

Set the poster image source url

Set the poster image source url

Attributes

src

Poster image source URL

def poster(): String

Get the poster image source url

Get the poster image source url

Attributes

Returns:

Poster image source URL

def preload(value: Boolean): Player.this.type

Set the preload attribute

Set the preload attribute

Attributes

value

Boolean to determine if preload should be used

def preload(): Boolean

Get the preload attribute

Get the preload attribute

Attributes

def readyState(): Int

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.

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.

Attributes

def remainingTime(): Int

Calculates how much time is left.

Calculates how much time is left.

Attributes

def remoteTextTrackEls(): Array[Element]

Get an array of remote html track elements

Get an array of remote html track elements

Attributes

def remoteTextTracks(): Array[String]

Get an array of remote text tracks

Get an array of remote text tracks

Attributes

def removeRemoteTextTrack(track: Object): Unit

Remove a remote text track

Remove a remote text track

Attributes

track

Remote text track to remove

def reportUserActivity(event: Object): Unit

Report user activity

Report user activity

Attributes

event

Event object

def requestFullscreen(): Unit

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.

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.

Attributes

def reset(): Player.this.type

Reset the player. Loads the first tech in the techOrder, and calls reset on the tech.

Reset the player. Loads the first tech in the techOrder, and calls reset on the tech.

Attributes

def scrubbing(isScrubbing: Boolean): Player.this.type

Attributes

isScrubbing

True/false the user is scrubbing

def scrubbing(): Boolean

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.

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.

Attributes

def seekable(): TimeRanges

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

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

Attributes

def seeking(): Boolean

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

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

Attributes

def selectSource(sources: Array[VideoSource]): 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

Select source based on tech-order or source-order Uses source-order selection if options.sourceOrder is truthy. Otherwise, defaults to tech-order selection

Attributes

sources

The sources for a media asset

Returns:

Object of source and tech order, otherwise false

def src(source: String | Array[VideoSource] | VideoSource): Player.this.type

The source function updates the video source. There are three types of variables you can pass as the argument.

The source function updates the video source. There are three types of variables you can pass as the argument.

  • URL String: A URL to the the video file. Use this method if you are sure the current playback technology (HTML5/Flash) can support the source you provide. Currently only MP4 files can be used in both HTML5 and Flash.
  • Source Object (or element): A javascript object containing information about the source file. Use this method if you want the player to determine if it can support the file using the type information.
  • Array of Source Objects: To provide multiple versions of the source so that it can be played using HTML5 across browsers you can use an array of source objects. Video.js will detect which version is supported and load that file.

Attributes

source

The source URL, object, or array of sources

Returns:

The player when setting

def src(): String

Attributes

Returns:

The current video source when getting

def supportsFullScreen(): Boolean

Check to see if fullscreen is supported

Check to see if fullscreen is supported

Attributes

def tech(safety: Object): Object

Return a reference to the current tech. It will only return a reference to the tech if given an object with the IWillNotUseThisInPlugins property on it. This is try and prevent misuse of techs by plugins.

Return a reference to the current tech. It will only return a reference to the tech if given an object with the IWillNotUseThisInPlugins property on it. This is try and prevent misuse of techs by plugins.

Attributes

Returns:

The Tech

def textTracks(): Array[Object]

Get an array of associated text tracks. captions, subtitles, chapters, descriptions

Get an array of associated text tracks. captions, subtitles, chapters, descriptions

Attributes

Returns:

Array of track objects

See also:
def toJSON(): Object

Converts track info to JSON

Converts track info to JSON

Attributes

Returns:

JSON object of options

def updateStyleEl_(): Unit

Update styles of the player element (height, width and aspect ratio)

Update styles of the player element (height, width and aspect ratio)

Attributes

def userActive(bool: Boolean): Player.this.type

Set if user is active

Set if user is active

Attributes

bool

Value when setting

def userActive(): Boolean

Get if user is active

Get if user is active

Attributes

Returns:

Value if user is active user when getting

def videoHeight(): Int

Get video height

Get video height

Attributes

def videoWidth(): Int

Get video width

Get video width

Attributes

def volume(percentAsDecimal: Double): Player.this.type

Set the current volume of the media 0 is off (muted), 1.0 is all the way up, 0.5 is half way.

Set the current volume of the media 0 is off (muted), 1.0 is all the way up, 0.5 is half way.

Attributes

percentAsDecimal

The new volume as a decimal percent

def volume(): Double

Get the current volume of the media 0 is off (muted), 1.0 is all the way up, 0.5 is half way.

Get the current volume of the media 0 is off (muted), 1.0 is all the way up, 0.5 is half way.

Attributes

Inherited methods

def $(selector: String, context: Element | String): Element

Attributes

Inherited from:
Component
def $$(selector: String, context: Element | String): NodeList[Node]

Attributes

Inherited from:
Component
def addChild(child: String | Component, options: Object): Unit

Attributes

Inherited from:
Component
def addClass(classToAdd: String): Unit

Attributes

Inherited from:
Component
def buildCSSClass(): String

Attributes

Inherited from:
Component
def children(): Array[Component]

Attributes

Inherited from:
Component
def clearInterval(intervalId: Int): Unit

Attributes

Inherited from:
Component
def clearTimeout(timeoutId: Int): Unit

Attributes

Inherited from:
Component
def contentEl(): Element

Attributes

Inherited from:
Component
def controlText(el: Element): Element

Attributes

Inherited from:
Component
def createEl(tagName: String, properties: Object, attributes: Object): Element

Attributes

Inherited from:
Component
def dimensions(width: Int | String, height: Int | String): Unit

Attributes

Inherited from:
Component
def dispose(): Unit

Attributes

Inherited from:
Component
def el(): Element

Attributes

Inherited from:
Component

Attributes

Inherited from:
Component
def getChild(name: String): Component

Attributes

Inherited from:
Component
def getChildById(id: String): Component

Attributes

Inherited from:
Component
def handleBlur(): Unit

Attributes

Inherited from:
Component
def handleClick(): Unit

Attributes

Inherited from:
Component
def handleFocus(): Unit

Attributes

Inherited from:
Component
def handleKeyPress(): Unit

Attributes

Inherited from:
Component
def hasClass(classToCheck: String): Boolean

Attributes

Inherited from:
Component
def hasOwnProperty(v: String): Boolean

Attributes

Inherited from:
Object
def height(num: Int | String, skipListeners: Boolean): Int

Attributes

Inherited from:
Component
def hide(): Unit

Attributes

Inherited from:
Component
def id(): String

Attributes

Inherited from:
Component
def initChildren(): Unit

Attributes

Inherited from:
Component
def isPrototypeOf(v: Object): Boolean

Attributes

Inherited from:
Object
def name(): String

Attributes

Inherited from:
Component
def off(event: String, handler: Function): Unit

Attributes

Inherited from:
Component
def off(component: Component, event: String, handler: Function): Unit

Attributes

Inherited from:
Component
def on(event: String, handler: Function): Unit

Attributes

Inherited from:
Component
def on(component: Component, event: String, handler: Function): Unit

Attributes

Inherited from:
Component
def one(event: String, handler: Function): Unit

Attributes

Inherited from:
Component
def one(component: Component, event: String, handler: Function): Unit

Attributes

Inherited from:
Component
def options(obj: Object): Object

Attributes

Inherited from:
Component
def player(): Player

Attributes

Inherited from:
Component
def propertyIsEnumerable(v: String): Boolean

Attributes

Inherited from:
Object
def ready(fn: Function, sync: Boolean): Component.this.type

Attributes

Inherited from:
Component
def removeChild(component: Component): Unit

Attributes

Inherited from:
Component
def removeClass(classToRemove: String): Unit

Attributes

Inherited from:
Component
def setInterval(fn: Function, interval: Int): Unit

Attributes

Inherited from:
Component
def setTimeout(fn: Function, timeout: Int): Unit

Attributes

Inherited from:
Component
def show(): Unit

Attributes

Inherited from:
Component
def toLocaleString(): String

Attributes

Inherited from:
Object
def toggleClass(classToToggle: String, predicate: Function | Boolean): Unit

Attributes

Inherited from:
Component
def trigger(event: Object | String, hash: Object): Unit

Attributes

Inherited from:
Component
def triggerReady(): Unit

Attributes

Inherited from:
Component
def valueOf(): Any

Attributes

Inherited from:
Object
def width(num: Int | String, skipListeners: Boolean): Int

Attributes

Inherited from:
Component