Options
All
  • Public
  • Public/Protected
  • All
Menu

Class VideoPlayer

Video player.

Hierarchy

  • VideoPlayer

Index

Constructors

constructor

Properties

Protected _c

Protected _el

_el: HTMLMediaElement

Protected _src

_src: URLString

Methods

canPlayType

  • canPlayType(type: string): CanPlayTypeResult
  • Returns a string that specifies whether the client can play a given media resource type.

    Parameters

    • type: string

    Returns CanPlayTypeResult

crossOrigin

  • crossOrigin(): string | null
  • crossOrigin(s: string): this
  • Returns string | null

  • Parameters

    • s: string

    Returns this

currentTime

  • currentTime(): number
  • currentTime(t: number): this
  • Gets or sets the current playback position, in seconds.

    Returns number

  • Parameters

    • t: number

    Returns this

defaultMuted

  • defaultMuted(): boolean
  • defaultMuted(is: boolean): this
  • Gets or sets the default muted when the user is not muted on a video resource.

    Returns boolean

  • Parameters

    • is: boolean

    Returns this

defaultPlaybackRate

  • defaultPlaybackRate(): number
  • defaultPlaybackRate(r: number): this
  • Gets or sets the default playback rate when the user is not using fast forward or reverse for a video resource.

    Returns number

  • Parameters

    • r: number

    Returns this

duration

  • duration(): number
  • Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming.

    Returns number

ended

  • ended(): boolean
  • Gets information about whether the playback has ended or not.

    Returns boolean

error

  • error(): MediaError | null
  • Returns an object representing the current error state of the audio or video element.

    Returns MediaError | null

loop

  • loop(): boolean
  • loop(is: boolean): this
  • Gets or sets a flag to specify whether playback should restart after it completes.

    Returns boolean

  • Parameters

    • is: boolean

    Returns this

muted

  • muted(): boolean
  • muted(is: boolean): this
  • Gets or sets a flag that indicates whether the audio track on video media is muted.

    Returns boolean

  • Parameters

    • is: boolean

    Returns this

on

  • on(e: MediaEvents, fn: (this: HTMLMediaElement) => void): void
  • Parameters

    • e: MediaEvents
    • fn: (this: HTMLMediaElement) => void
        • (this: HTMLMediaElement): void
        • Parameters

          • this: HTMLMediaElement

          Returns void

    Returns void

pause

  • pause(): this
  • Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not.

    Returns this

paused

  • paused(): boolean
  • Gets a flag that specifies whether playback is paused.

    Returns boolean

play

  • Loads and starts playback of a media resource.

    Note: Uncaught (in promise) DOMException: play() failed because the user didn’t interact with the document first. Autoplay Policy Changes:

    1. Muted autoplay is always allowed.
    2. Autoplay with sound is allowed if: User has interacted with the domain (click, tap, etc.). On desktop, the user’s Media Engagement Index threshold has been crossed, meaning the user has previously play video with sound. On mobile, the user has added the site to his or her home screen.
    3. Top frames can delegate autoplay permission to their iframes to allow autoplay with sound.

    Returns Promise<void>

playbackRate

  • playbackRate(): number
  • playbackRate(r: number): this
  • Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource.

    Returns number

  • Parameters

    • r: number

    Returns this

played

  • played(): TimeRanges
  • Gets TimeRanges for the current media resource that has been played.

    Returns TimeRanges

preload

  • preload(): "auto" | "meta" | "none"
  • preload(s: "auto" | "meta" | "none"): this
  • Returns "auto" | "meta" | "none"

  • Parameters

    • s: "auto" | "meta" | "none"

    Returns this

src

  • Gets/Sets the address or URL of the current media resource.

    Returns URLString

  • Parameters

    Returns this

volume

  • volume(): number
  • volume(v: number): this
  • Gets or sets the volume level for audio portions of the media element.

    Returns number

  • Parameters

    • v: number

    Returns this