Options
All
  • Public
  • Public/Protected
  • All
Menu

This component creates instance of single video player. See PlayerParams for accepted parameters

new Player(parentContainer, {
    video: VIDEO_OBJECT,
    loop: true,
    autoplay: true,
    volume: 1
})

Hierarchy

  • UIComponent<PlayerEventMap>
    • Player

Index

Constructors

constructor

  • Create component instance with parent constructor

    Parameters

    Returns Player

Properties

Optional playlist

playlist: Playlist

Optional playlistIndex

playlistIndex: number

subscribe

subscribe: <FullEventMap, Event>(event: Event, callback: EventHandler<Event, FullEventMap[Event]>) => () => void = ...

Subscribe on component event

param

Event name

param

Callback function

Type declaration

    • <FullEventMap, Event>(event: Event, callback: EventHandler<Event, FullEventMap[Event]>): () => void
    • Subscribe on event

      Type parameters

      • FullEventMap: PlayerEventMap & { *: any }

      • Event: string

      Parameters

      • event: Event

        This string can contain: event name, namespace of event name, list of event names separated by a space or '*' to subscribe on all events

      • callback: EventHandler<Event, FullEventMap[Event]>

        Callback function

      Returns () => void

      • Function that cancels current subscription
        • (): void
        • Returns void

unsubscribe

unsubscribe: <FullEventMap, Event>(event: Event, callback?: EventHandler<Event, FullEventMap[Event]>) => void = ...

Unsubscribe from component event

param

Event name

param

Callback function

Type declaration

    • <FullEventMap, Event>(event: Event, callback?: EventHandler<Event, FullEventMap[Event]>): void
    • Unsubscribe from event

      Type parameters

      • FullEventMap: PlayerEventMap & { *: any }

      • Event: string

      Parameters

      • event: Event

        This string can contain: event name, namespace of event name, list of event names separated by a space or '*' to unsubscribe from all events

      • Optional callback: EventHandler<Event, FullEventMap[Event]>

        Callback function

      Returns void

Optional video

video: Video

Accessors

aspectMode

  • Player's aspect ratio mode

    Returns AspectMode

  • Player's aspect ratio mode

    Parameters

    Returns void

autoplay

  • get autoplay(): boolean
  • set autoplay(autoplay: boolean): void
  • Whether player should start playing of video as soon as it is loaded

    Returns boolean

  • Whether player should start playing of video as soon as it is loaded

    Parameters

    • autoplay: boolean

    Returns void

buffered

  • get buffered(): number
  • Float between 0 and 1 indicating how much of the video is buffered

    Returns number

canPlay

  • get canPlay(): Boolean
  • Whether video is ready for playback

    Returns Boolean

currentTime

  • get currentTime(): number
  • set currentTime(currentTime: number): void
  • Current playback time

    Returns number

  • Current playback time

    Parameters

    • currentTime: number

    Returns void

duration

  • get duration(): number
  • Duration of the current video

    Returns number

element

  • get element(): HTMLElement
  • Root HTML element

    Returns HTMLElement

hideControlsTimeout

  • get hideControlsTimeout(): number
  • set hideControlsTimeout(hideControlsTimeout: number): void
  • If greater than 0, player will hide controls if user is inactive for specified amount of milliseconds.

    Returns number

  • If greater than 0, player will hide controls if user is inactive for specified amount of milliseconds.

    Parameters

    • hideControlsTimeout: number

    Returns void

isFullscreen

  • get isFullscreen(): Boolean
  • Return flag whether player is in the fullscreen mode

    Returns Boolean

loop

  • get loop(): boolean
  • set loop(loop: boolean): void
  • Whether player should loop playing of video

    Returns boolean

  • Whether player should loop playing of video

    Parameters

    • loop: boolean

    Returns void

muted

  • get muted(): boolean
  • set muted(muted: boolean): void
  • Whether player should mute video

    Returns boolean

  • Whether player should mute video

    Parameters

    • muted: boolean

    Returns void

paused

  • get paused(): Boolean
  • Whether video is paused

    Returns Boolean

playOnFocus

  • get playOnFocus(): boolean
  • set playOnFocus(playOnFocus: boolean): void
  • Whether player should start playing of video when video is in the middle of the screen

    Returns boolean

  • Whether player should start playing of video when video is in the middle of the screen

    Parameters

    • playOnFocus: boolean

    Returns void

playbackQuality

  • get playbackQuality(): undefined | HIGH | MEDIUM | LOW
  • set playbackQuality(playbackQuality: undefined | HIGH | MEDIUM | LOW): void
  • Preferred video quality that should be used for playback

    Returns undefined | HIGH | MEDIUM | LOW

  • Preferred video quality that should be used for playback

    Parameters

    Returns void

playing

  • get playing(): Boolean
  • Whether video is playing

    Returns Boolean

rate

  • get rate(): number
  • set rate(rate: number): void
  • Player playback rate

    Returns number

  • Player playback rate

    Parameters

    • rate: number

    Returns void

showControls

  • get showControls(): boolean
  • set showControls(showControls: boolean): void
  • Whether player should show controls

    Returns boolean

  • Whether player should show controls

    Parameters

    • showControls: boolean

    Returns void

size

  • get size(): string
  • set size(size: string): void
  • Player size mode

    Returns string

  • Player size mode

    Parameters

    • size: string

    Returns void

volume

  • get volume(): number
  • set volume(volume: number): void
  • Player volume (float between 0 and 1)

    Returns number

  • Player volume (float between 0 and 1)

    Parameters

    • volume: number

    Returns void

Methods

destroy

  • destroy(): void
  • Destroy component instance and remove it from the DOM

    Returns void

goToNextVideo

  • goToNextVideo(): void
  • Play next video from playlist.

    Returns void

goToPreviousVideo

  • goToPreviousVideo(): void
  • Play previous video from playlist.

    Returns void

load

  • load(): void
  • Start preloading of current video

    Returns void

pause

  • pause(): void
  • Pause playback of current video

    Returns void

play

  • play(params?: { currentTime?: number }): void
  • Start playback of current video

    Parameters

    • params: { currentTime?: number } = {}
      • Optional currentTime?: number

    Returns void

setPlaylist

  • setPlaylist(playlist: Playlist, index?: number): void
  • Set new playlist to player

    Parameters

    • playlist: Playlist

      Playlist to play

    • index: number = 0

      Index of video from playlist to play

    Returns void

setPlaylistIndex

  • setPlaylistIndex(index?: number, force?: boolean): void
  • Set index of video from playlist to play

    Parameters

    • index: number = 0

      Index of video from playlist to play

    • force: boolean = false

    Returns void

setVideo

  • setVideo(video: Video): void
  • Set new video to player

    Parameters

    • video: Video

      Video object

    Returns void

setVideoId

  • setVideoId(videoId: string): void
  • Set new video id to player

    Parameters

    • videoId: string

      Video id

    Returns void

toggleFullscreen

  • toggleFullscreen(): Promise<void>
  • Toggle fullscreen mode (should be called only in callback of user event)

    Returns Promise<void>

unload

  • unload(): void
  • Unload current video

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property

Generated using TypeDoc