Class: BaseComponent

BaseComponent()

new BaseComponent()

BaseComponent is the bedrock of any visualisation here. It must be inherited from Mono or Stereo component abstractions.

Store all base method, mostly to handle events, other processing methods needs to be overridden.
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source:

Members

(private) _audioCtx :object

The audio context

Type:
  • object
Source:

(private) _dom :object

Contains all useful DOM objects

Type:
  • object
Source:

(private) _fftSize :number

FFT size used to analyse audio stream. Must be a power of 2

Type:
  • number
Source:

(private) _inputNode :object

The source node to chain from ; it will ignore the output of HTML audio player

Type:
  • object
Source:

(private) _isPlaying :boolean

The playing state of the player

Type:
  • boolean
Source:

(private) _parentDimension :object

Save container dimension to restore when closing fullscreen

Type:
  • object
Source:

(private) _player :object

The audio source (HTML audio player)

Type:
  • object
Source:

(private) _renderTo :object

Target div to render module in

Type:
  • object
Source:

(private) _resizeObserver :object

Resize observable to watch for any resize change

Type:
  • object
Source:

(private) _type :string

The component type. See supported componenets in AudioVisualizer factory

Type:
  • string
Source:

Methods

(private, static) _addEvents()

Add component events (resize, play, pause, dbclick).
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source:

(private, static) _buildUI()

Create, configure and append UI in DOM. Must be implemented in sub class.
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source:

(private, static) _clearCanvas()

Clear component canvas contexts from their content. Must be implemented in sub class.
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source:

(private, static) _dblClick()

On double click event callback (toggle fullscreen).
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source:

(private, static) _fillAttributes()

Build component properties from options. Must be implemented in sub class.
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source:

(private, static) _onResize()

On resize event callback. Must be implemented in sub class.
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source:

(private, static) _pause()

On pause event callback.
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source:

(private, static) _play()

On play event callback.
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source:

(private, static) _processAudioBin()

Real time audio analysis using PCM data from WebAudioAPI. Must be implemented in sub class.
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source:

(private, static) _removeEvents()

Remove component events (resize, play, pause, dbclick).
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source:

(private, static) _setAudioNodes()

Build audio chain with source. Must be implemented in sub class.
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source:

(static) destroy()

The destroy method to clear events and remove all component properties.
Since:
  • 2020
Author:
  • Arthur Beaulieu
Source: