wavesurfer.js
    Preparing search index...

    Thin wrapper mirroring spectrogram.ts's own SpectrogramPlugin class - see its doc comment for why create-time validation needs a constructor, not just a check inside setup().

    Hierarchy

    • WindowedDefined
      • default
    Index
    __spectrogramInternalsForTests: () => TestInternals

    test-only, see TestInternals

    clearCache: () => void

    Clear cached frequency data to force recalculation. 'full' mode only - a no-op (with a console.warn) in 'windowed' mode, whose segment cache lives in segmentManager instead; see loadFrequenciesData's doc comment for why.

    getFrequenciesData: () => Promise<Uint8Array<ArrayBufferLike>[][] | null>

    Get the current frequency data, computing (and caching) it from the decoded audio if needed. 'full' mode only - a no-op (returns null, with a console.warn) in 'windowed' mode; see loadFrequenciesData's doc comment for why.

    getLoadingProgress: () => number

    Windowed rendering only: current loading progress as a percentage (0-100); 100 in 'full' mode.

    loadFrequenciesData: (url: string | URL) => Promise<void>

    Fetch pre-computed spectrogram JSON data from a URL and render it. 'full' mode only - a no-op (with a console.warn) in 'windowed' mode, where data is computed and cached per segment via progressive loading instead of as one whole-buffer result; calling this would fight the segment renderer's own canvases.

    options: Options
    restartProgressiveLoading: () => void

    Windowed rendering only: restart progressive background loading from the beginning. No-op in 'full' mode.

    scope: Scope = ...

    A disposal scope owned by the plugin chassis, disposed by destroy(). definePlugin (see define-plugin.ts) replaces this with a fresh Scope on every (re-)init; class-based plugins that support destroy() -> _init() re-init must do the same in onInit().

    stopProgressiveLoading: () => void

    Windowed rendering only: stop progressive background loading if it's currently running. No-op in 'full' mode.

    subscriptions: (() => void)[] = []
    wavesurfer?: default
    • get destroyed(): boolean

      Whether destroy() has been called. Subclasses use this to guard async work.

      Returns boolean

    • Do not call directly, only called by WavesSurfer internally

      Parameters

      Returns void

    • Destroy the plugin and unsubscribe from all events

      Returns void

    • Subscribe to an event. Returns an unsubscribe function.

      Type Parameters

      • EventName extends "ready" | "error" | "destroy" | "progress" | "click"

      Parameters

      Returns () => void

    • Called after this.wavesurfer is available

      Returns void

    • Clear all events

      Returns void