Options
All
  • Public
  • Public/Protected
  • All
Menu

Abstract analyzer widget.

This class is the basic class to inherit and implement other widgets.

Hierarchy

Index

Constructors

constructor

  • Constructor.

    Parameters

    • Optional audioSource: HTMLMediaElement | MediaElementAudioSourceNode

      Input HTML element with source audio (HTML audio tag) or the instance of MediaElementAudioSourceNode.

    • Optional viewElement: HTMLElement

      The HTML element to render the widget. Will be auto created if it is undefined or null.

    • Optional options: IAbstractAnalyzerOptions

      Analyzer options.

    Returns AbstractAnalyzer

Properties

Protected analyser

analyser: AnalyserNode

Protected audioContext

audioContext: AudioContext

Protected audioElement

audioElement: HTMLMediaElement

Protected bufferLength

bufferLength: number

Protected canvasContext

canvasContext: CanvasRenderingContext2D

Protected canvasElement

canvasElement: HTMLCanvasElement

Protected color

color: string

Protected connectDestination

connectDestination: boolean

Protected dataArray

dataArray: Uint8Array

Protected fftSize

fftSize: number

Protected height

height: number

Protected isAudioContextInitialized

isAudioContextInitialized: boolean = false

Protected mediaSource

mediaSource: MediaElementAudioSourceNode

Protected requestAniFrameID

requestAniFrameID: number

Protected sourceChannel

sourceChannel: number

Protected viewElement

viewElement: HTMLElement

Protected width

width: number

Protected Static audioSources

audioSources: IAudioSource[] = ...

The list of audio sources.

Methods

changeAudioSource

  • changeAudioSource(audioSource?: HTMLMediaElement | MediaElementAudioSourceNode): void
  • Changes the current media source.

    Parameters

    • Optional audioSource: HTMLMediaElement | MediaElementAudioSourceNode

      Input HTML element with source audio (HTML audio tag) or the instance of MediaElementAudioSourceNode.

    Returns void

clear

  • clear(): void
  • Clears the canvas.

    Returns void

Protected createAnalyzer

  • createAnalyzer(): void
  • Returns void

getAudioSource

  • Returns the audio source structure for this instance.

    Returns IAudioSource

    The audio source structure.

Protected getDefaultColor

  • getDefaultColor(): string
  • Returns string

Protected getDefaultFftSize

  • getDefaultFftSize(): number
  • Returns number

Protected getDefaultViewElement

  • getDefaultViewElement(): HTMLElement
  • Returns HTMLElement

getViewElement

  • getViewElement(): HTMLElement
  • Returns the ViewElement for this instance.

    Returns HTMLElement

Protected initAnalyzer

  • initAnalyzer(): void
  • Returns void

Protected initAudio

  • initAudio(): void
  • Returns void

Protected initView

  • initView(): void
  • Returns void

pause

  • pause(): void
  • Pauses rendering.

    Returns void

Protected Abstract render

  • render(): void
  • Draws analyzer graphic.

    Method to override.

    Returns void

resize

  • resize(): void
  • Updates the canvas size depended on the viewElement size.

    Returns void

Protected setAudioSource

  • setAudioSource(audioSource?: HTMLMediaElement | MediaElementAudioSourceNode): void
  • Parameters

    • Optional audioSource: HTMLMediaElement | MediaElementAudioSourceNode

    Returns void

Protected setOptions

Protected setViewElement

  • setViewElement(viewElement?: HTMLElement): void
  • Parameters

    • Optional viewElement: HTMLElement

    Returns void

start

  • start(): void
  • Starts rendering.

    Returns void

stop

  • stop(): void
  • Stops rendering.

    Returns void

Protected Static createAudioSourceForElement

  • createAudioSourceForElement(audioElement: HTMLMediaElement, connectDestination: boolean): IAudioSource
  • Parameters

    • audioElement: HTMLMediaElement
    • connectDestination: boolean

    Returns IAudioSource

Protected Static findAudioSourceByElement

  • findAudioSourceByElement(audioElement: HTMLMediaElement): void | IAudioSource
  • Parameters

    • audioElement: HTMLMediaElement

    Returns void | IAudioSource

Protected Static normalizeColor

  • normalizeColor(color: string): string
  • Converts short format color '#abc' to long format color: '#aabbcc'.

    Parameters

    • color: string

    Returns string

Generated using TypeDoc