Type alias WaveSurferOptions

WaveSurferOptions: {
    audioRate?: number;
    autoCenter?: boolean;
    autoScroll?: boolean;
    autoplay?: boolean;
    barAlign?: "top" | "bottom";
    barGap?: number;
    barHeight?: number;
    barRadius?: number;
    barWidth?: number;
    container: HTMLElement | string;
    cursorColor?: string;
    cursorWidth?: number;
    duration?: number;
    fetchParams?: RequestInit;
    fillParent?: boolean;
    height?: number | "auto";
    hideScrollbar?: boolean;
    interact?: boolean;
    media?: HTMLMediaElement;
    minPxPerSec?: number;
    normalize?: boolean;
    peaks?: (Float32Array | number[])[];
    plugins?: GenericPlugin[];
    progressColor?: string | string[] | CanvasGradient;
    renderFunction?: ((peaks, ctx) => void);
    sampleRate?: number;
    splitChannels?: WaveSurferOptions[];
    url?: string;
    waveColor?: string | string[] | CanvasGradient;
}

Type declaration

  • Optional audioRate?: number

    Audio rate

  • Optional autoCenter?: boolean

    If autoScroll is enabled, keep the cursor in the center of the waveform during playback

  • Optional autoScroll?: boolean

    Automatically scroll the container to keep the current position in viewport

  • Optional autoplay?: boolean

    Play the audio on load

  • Optional barAlign?: "top" | "bottom"

    Vertical bar alignment

  • Optional barGap?: number

    Spacing between bars in pixels

  • Optional barHeight?: number

    A vertical scaling factor for the waveform

  • Optional barRadius?: number

    Rounded borders for bars

  • Optional barWidth?: number

    Render the waveform with bars like this: ▁ ▂ ▇ ▃ ▅ ▂

  • container: HTMLElement | string

    HTML element or CSS selector

  • Optional cursorColor?: string

    The color of the playpack cursor

  • Optional cursorWidth?: number

    The cursor width

  • Optional duration?: number

    Pre-computed duration

  • Optional fetchParams?: RequestInit

    Options to pass to the fetch method

  • Optional fillParent?: boolean

    Stretch the waveform to fill the container, true by default

  • Optional height?: number | "auto"

    The height of the waveform in pixels, or "auto" to fill the container height

  • Optional hideScrollbar?: boolean

    Hide the scrollbar

  • Optional interact?: boolean

    Pass false to disable clicks on the waveform

  • Optional media?: HTMLMediaElement

    Use an existing media element instead of creating one

  • Optional minPxPerSec?: number

    Minimum pixels per second of audio (i.e. zoom level)

  • Optional normalize?: boolean

    Stretch the waveform to the full height

  • Optional peaks?: (Float32Array | number[])[]

    Pre-computed audio data

  • Optional plugins?: GenericPlugin[]

    The list of plugins to initialize on start

  • Optional progressColor?: string | string[] | CanvasGradient

    The color of the progress mask

  • Optional renderFunction?: ((peaks, ctx) => void)
      • (peaks, ctx): void
      • Custom render function

        Parameters

        • peaks: (Float32Array | number[])[]
        • ctx: CanvasRenderingContext2D

        Returns void

  • Optional sampleRate?: number

    Decoding sample rate. Doesn't affect the playback. Defaults to 8000

  • Optional splitChannels?: WaveSurferOptions[]

    Render each audio channel as a separate waveform

  • Optional url?: string

    Audio URL

  • Optional waveColor?: string | string[] | CanvasGradient

    The color of the waveform

Generated using TypeDoc