Audio scrub plugin

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

Constructors

Properties

name: string
Name: string = AUDIO_SCRUB_PLUGIN_NAME
QUEUE_MAX_SIZE: number = 1

Accessors

  • get loaded(): 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.

    Returns boolean

  • set loaded(loaded): void
  • Parameters

    • loaded: boolean

    Returns void

  • get muted(): 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.

    Returns boolean

  • set muted(muted): void
  • Parameters

    • muted: boolean

    Returns void

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

    Returns string

Methods

  • Adds an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

  • Unregisters itself with the player and removes all internal and external event listeners.

    Returns void

  • Disable audio scrubbing functionality.

    Returns void

  • Enable audio scrubbing functionality. Enabled by default on creation.

    Returns void

  • Returns the duration each frame is played.

    Returns number

  • Plugin actions are optional and by default a plugin does not contain any actions.

    Returns PluginAction[]

  • Returns the shadowed audio tag from a registered element.

    Parameters

    • master: HTMLMediaElement

      The registered element.

    Returns HTMLMediaElement

  • Alias method for removeEventListener.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

  • Alias method for addEventListener.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

  • Register one or more audio tracks.

    tracks The audio track(s).

    Parameters

    Returns void

  • Removes an event listener for a specific event.

    Parameters

    • type: string

      Event type.

    • callback: Listener

      Listener callback function.

    Returns void

  • Update the duration each frame is played. Overrides setting.

    Parameters

    • duration: number

      The duration to play in ms.

    Returns void

  • Unregister one or more audio tracks.

    Parameters

    • Rest ...srcsOrIds: string[]

    Returns void

  • Update offset for scrubbing track.

    Parameters

    • srcOrId: string
    • offset: number

      The offset to set on track.

    Returns void