Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Service
    • AbrService

Index

Constructors

constructor

  • new AbrService(master: HTMLVideoElement, eventCallback: <T>(event: T) => void, internalEventBus: EventMixin, settings: AbrPlayerSettings): AbrService
  • Note Should only be used from within the player.

    Parameters

    • master: HTMLVideoElement

      The video element.

    • eventCallback: <T>(event: T) => void

      Callback to control internal event handling.

        • <T>(event: T): void
        • Type parameters

          • T: PlayerEvent

          Parameters

          • event: T

          Returns void

    • internalEventBus: EventMixin

      Event bus for internal communication.

    • settings: AbrPlayerSettings

      Basic settings controlling the behavior.

    Returns AbrService

Properties

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[]

shakaInstance

  • get shakaInstance(): Shaka

Methods

abrEnabled

  • abrEnabled(): boolean
  • Check if the abr-manager (automatic switch) is enabled.

    Returns boolean

    True if enabled.

cancelLoop

  • cancelLoop(): void
  • Cancels loop playback.

    Returns void

clearAllRequestFilters

  • clearAllRequestFilters(): void
  • Reset all registered request interceptors.

    Returns void

clearAllResponseFilters

  • clearAllResponseFilters(): void
  • Reset all registered response interceptors.

    Returns void

configureShaka

  • configureShaka(config: any): 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>

getActiveAudioId

  • getActiveAudioId(): number
  • Returns the current playing audios id. The id corresponds to the currently playing audio track

    Returns number

getActiveFile

  • getActiveFile(): VideoFile
  • Returns the active video file or undefined if no video file is loaded.

    Returns VideoFile

getActiveSubtitleId

  • getActiveSubtitleId(): number
  • Returns number

getActiveVideoRepresentationId

  • getActiveVideoRepresentationId(): number
  • Returns the id of the active video representation, or -1 if set to auto.

    Returns number

getAudioTracks

  • Get the audio tracks.

    Returns ShakaPlayerAudioTrack[]

    An array of audio tracks.

getCurrentTime

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

    Parameters

    • Optional 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

    • Optional format: TimeFormat

      The format to return the duration in.

    Returns string | number

getStatus

  • getStatus(): PlayerStatus
  • Returns the current status of the active media.

    Returns PlayerStatus

getSubtitles

  • Gets the subtitle tracks.

    Returns ShakaPlayerTrack[]

    An array of subtitle text tracks.

getVideoRepresentations

  • getVideoRepresentations(): VideoRepresentation[]
  • Returns all available video representations.

    Returns VideoRepresentation[]

increasePlaybackRate

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

    Returns void

listPlugins

  • listPlugins(): Plugin[]
  • Returns a list of all registered plugins.

    Returns Plugin[]

loadVideoFile

  • loadVideoFile(videoFile: VideoFile): void
  • Load a specific video file.

    throws

    Throws error originated from shaka-player if load fails.

    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.

    • Optional userPause: boolean

    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>

registerRequestFilter

  • Register an interceptor for shaka players network calls.

    Parameters

    Returns void

registerResponseFilter

  • Register an interceptor for shaka players network responses.

    Parameters

    Returns void

seek

  • seek(event: SeekEvent, roundingMode?: RoundingMode): Promise<void>
  • Seeks to a specific time in the current media.

    Parameters

    • event: SeekEvent

      Specifies where to seek to within the media.

    • Optional roundingMode: RoundingMode

    Returns Promise<void>

setAudioTrack

  • setAudioTrack(id: number): void
  • Set the audio track.

    Parameters

    • id: number

      of the audio track.

    Returns 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

setSubtitleTrack

  • setSubtitleTrack(id: number): void
  • Sets a subtitle track.

    Parameters

    • id: number

      of the subtitle track.

    Returns void

setVideoRepresentation

  • setVideoRepresentation(id: number): void
  • Set the desired video representation using id. -1 will enable auto switch.

    Parameters

    • id: number

      The id of the desired representation.

    Returns void

setVolume

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

    Parameters

    • volume: number

      A number between 0 and 1.

    Returns void

setVolumeController

  • setVolumeController(volumeController: VolumeController): void
  • Sets the default controller for the volume

    Parameters

    • volumeController: VolumeController

      the volume controller

    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

    • videoFile: VideoFile

    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