Options
All
  • Public
  • Public/Protected
  • All
Menu

Service layer serves as the api of a player. It should provide high level function and use the adapter to accomplish the tasks.

Hierarchy

  • Service

Index

Constructors

constructor

  • Parameters

    • master: HTMLVideoElement
    • eventCallback: <T>(event: T) => void
        • <T>(event: T): void
        • Type parameters

          Parameters

          • event: T

          Returns void

    • _internalEventBus: EventMixin
    • settings: PlayerSettings

    Returns Service

Properties

Readonly playbackRates

playbackRates: number[] = ...

plugin

plugin: PluginApi = {}

An object containing all currently registered plugins. Access a specific plugin using the Plugins static property Name, i.e. plugin[Plugin.Name].

Accessors

isLooping

  • get isLooping(): boolean
  • Returns boolean

isSeeking

  • get isSeeking(): boolean
  • Returns true if a seek is in progress, false otherwise

    Returns boolean

loaded

  • get loaded(): boolean
  • Player and plugins, if any, are ready for continued playback.

    Returns boolean

master

  • get master(): HTMLMediaElement
  • Returns HTMLMediaElement

maximumPlaybackRate

  • get maximumPlaybackRate(): number
  • The maximum acceptable value for playback rate.

    Returns number

    The maximum value.

minimumPlaybackRate

  • get minimumPlaybackRate(): number
  • The minimum acceptable value for playback rate.

    Returns number

    The minimum value.

muted

  • get muted(): boolean
  • Player and plugins, if any, are all muted.

    Returns boolean

playbackRateIncrements

  • get playbackRateIncrements(): number[]
  • Returns a list of playback rates that are used when increasing or decreasing playback rate.

    Returns number[]

Methods

cancelLoop

  • cancelLoop(): void
  • Cancels loop playback.

    Returns void

decreasePlaybackRate

  • decreasePlaybackRate(): void
  • Decreases the current playback rate based on predefined steps.

    Returns void

destroy

  • destroy(): Promise<void>
  • Destroys the service, should only be called from within the player.

    Returns Promise<void>

getActiveFile

  • Returns the active video file or undefined if no video file is loaded.

    Returns VideoFile

getCurrentTime

  • getCurrentTime(format?: TimeFormat): string | number
  • Returns the current time of the player in the requested format.

    Parameters

    • format: TimeFormat = ...

      The format to return the current time in.

    Returns string | number

getDuration

  • getDuration(format?: TimeFormat): string | number
  • Returns the duration of the current media in the requested format.

    Parameters

    • format: TimeFormat = ...

      The format to return the duration in.

    Returns string | number

getStatus

  • Returns the current status of the active media.

    Returns PlayerStatus

increasePlaybackRate

  • increasePlaybackRate(): void
  • Increases the current playback rate based on predefined steps.

    Returns void

listPlugins

  • Returns a list of all registered plugins.

    Returns Plugin[]

loadVideoFile

  • Load a specific video file.

    Parameters

    • videoFile: VideoFile

      The video file to load.

    Returns void

loop

  • loop(inFrame: number, outFrame: number): void
  • Loop section of loaded Video.

    Parameters

    • inFrame: number

      inclusive

    • outFrame: number

      exclusive

    Returns void

mute

  • mute(): void
  • Mutes the player.

    Returns void

muteMuxed

  • muteMuxed(): void
  • Mutes the muxed audio

    Returns void

onPlayerStatusChanged

  • onPlayerStatusChanged(): void
  • Helper method to make sure that playback is resumed correctly. Should only be used from within the player.

    Returns void

pause

  • pause(pauseOn?: SeekEvent, userPause?: boolean): Promise<void>
  • Pauses playback and makes sure that the player is stopped at an exact frame.

    Parameters

    • Optional pauseOn: SeekEvent

      (Optional) Seek to specific time when pausing.

    • userPause: boolean = true

    Returns Promise<void>

play

  • play(): Promise<void>
  • Starts playback. Queues requests if the player is seeking or loading to achieve autoplay behavior.

    Returns Promise<void>

seek

  • Seeks to a specific time in the current media.

    Parameters

    Returns Promise<void>

setFrameOffset

  • setFrameOffset(offset: number): void
  • Update frameOffset value for all loaded videoFiles. Equivalent to load videoFile with a specific frameOffset.

    Parameters

    • offset: number

      Frame offset to set.

    Returns void

setPlaybackRate

  • setPlaybackRate(rate: number): number
  • Sets the playback rate. Limited to predefined min- and max values.

    Parameters

    • rate: number

      The new playback rate

    Returns number

setVolume

  • setVolume(volume: number): void
  • Set the volume of the player.

    Parameters

    • volume: number

      A number between 0 and 1.

    Returns void

setVolumeController

  • Sets the default controller for the volume

    Parameters

    Returns void

toggleMute

  • toggleMute(): void
  • Toggles mute.

    Returns void

toggleMuteMuxed

  • toggleMuteMuxed(): void
  • Toggles mute on the muxed audio

    Returns void

togglePlay

  • togglePlay(): Promise<void>
  • Toggles playback.

    Returns Promise<void>

unmute

  • unmute(): void
  • Unmutes the player.

    Returns void

unmuteMuxed

  • unmuteMuxed(): void
  • Unmutes the muxed audio

    Returns void

updateVideoFile

  • updateVideoFile(videoFile: VideoFile): void
  • Parameters

    Returns void

useDropFrame

  • useDropFrame(dropFrame: boolean): void
  • Update the dropFrame value for all loaded videoFiles. Equivalent to load videoFile with dropFrame property set.

    Parameters

    • dropFrame: boolean

      Drop frame value to set.

    Returns void