Options
All
  • Public
  • Public/Protected
  • All
Menu

Note: This in an experimental feature currently only working with the progressive player and (or) with discrete audio tracks

The audio scrub plugin enables features to simulate audio scrubbing when seeking.

Minimal working example

The setting autoRegister (enabled by default) will make the plugin automatically register the master element and all discrete audio tracks for scrubbing. With it enabled, the following snippet is all that's required to activate scrubbing.

 ...
 // video and key should have been set earlier.
const player = new ProgressivePlayer(video, key);

 // Create and register plugin to player.
const plugin = new AudioScrubPlugin(player);
...

Now every seek operation should play a short segment of audio around the desired time.

Limitations

This plugin only works with tracks that uses progressive downloads. I.e. audio tracks through DiscreteAudioPlugin and/or video track through ProgressivePlayer.

A note about accuracy

The scrubbing feature tries to be as accurate as possible, but it is an estimation. We do not guarantee that the sound heard represent just the sound associated with a frame. You can tweak the audio sample duration to get a more exact result, using the setting frameSoundDuration.

Hierarchy

Index

Constructors

constructor

Properties

Readonly name

name: string

Static Name

Name: string = ...

Static QUEUE_MAX_SIZE

QUEUE_MAX_SIZE: number = 1

Accessors

loaded

  • get loaded(): boolean
  • set loaded(loaded: boolean): void
  • Property that states whether this plugin considers itself ready for continued playback based on internal logic. Triggers internal event of type PlayerInternalEventType.LoadedChanged if property value was changed.

    Returns boolean

  • Property that states whether this plugin considers itself ready for continued playback based on internal logic. Triggers internal event of type PlayerInternalEventType.LoadedChanged if property value was changed.

    Parameters

    • loaded: boolean

    Returns void

muted

  • get muted(): boolean
  • set muted(muted: boolean): void
  • Property that states whether this plugin considers itself muted based on internal logic. Triggers internal event of type PlayerInternalEventType.MutedChanged if property value was changed.

    Returns boolean

  • Property that states whether this plugin considers itself muted based on internal logic. Triggers internal event of type PlayerInternalEventType.MutedChanged if property value was changed.

    Parameters

    • muted: boolean

    Returns void

version

  • get version(): string
  • Property describing the plugin name and version.

    Returns string

Methods

addEventListener

  • addEventListener(type: string, callback: Listener): void
  • Adds an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

destroy

  • destroy(): void
  • Unregisters itself with the player and removes all internal and external event listeners.

    Returns void

disable

  • disable(): void
  • Disable audio scrubbing functionality.

    Returns void

enable

  • enable(): void
  • Enable audio scrubbing functionality. Enabled by default on creation.

    Returns void

getFrameSoundDuration

  • getFrameSoundDuration(): number
  • Returns the duration each frame is played.

    Returns number

getPluginActions

  • getPluginActions(): PluginAction[]
  • Plugin actions are optional and by default a plugin does not contain any actions.

    Returns PluginAction[]

getShadow

  • getShadow(master: HTMLMediaElement): HTMLMediaElement
  • Returns the shadowed audio tag from a registered element.

    Parameters

    • master: HTMLMediaElement

      The registered element.

    Returns HTMLMediaElement

off

  • off(type: string, callback: Listener): void
  • Alias method for removeEventListener.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

on

  • on(type: string, callback: Listener): void
  • Alias method for addEventListener.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

registerTracks

  • Register one or more audio tracks.

    tracks The audio track(s).

    Parameters

    Returns void

removeEventListener

  • removeEventListener(type: string, callback: Listener): void
  • Removes an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

setFrameSoundDuration

  • setFrameSoundDuration(duration: number): void
  • Update the duration each frame is played. Overrides setting.

    Parameters

    • duration: number

      The duration to play in ms.

    Returns void

unregisterTracks

  • unregisterTracks(...srcsOrIds: string[]): void
  • Unregister one or more audio tracks.

    Parameters

    • Rest ...srcsOrIds: string[]

    Returns void

updateOffset

  • updateOffset(srcOrId: string, offset: number): void
  • Update offset for scrubbing track.

    Parameters

    • srcOrId: string
    • offset: number

      The offset to set on track.

    Returns void