Constructor Summary
Public Constructor | ||
public |
constructor(container: HTMLElement, params: WavesurferParams) |
Member Summary
Public Members | ||
public |
container: * |
|
public |
The height of the renderer |
|
public |
|
|
public |
|
|
public |
The width of the renderer |
|
public |
The |
Method Summary
Public Methods | ||
public abstract |
Clear the waveform |
|
public |
Create the wrapper |
|
public |
destroy() This is called when wavesurfer is destroyed |
|
public abstract |
Draw a waveform with bars |
|
public |
Draw peaks on the canvas |
|
public abstract |
Draw a waveform |
|
public |
getProgressPixels(wrapperBbox: *, clientX: *): * |
|
public |
getScrollX(): number Get the current scroll position in pixels |
|
public |
Get the width of the container |
|
public |
handleEvent(e: Event, noPrevent: boolean): number Handle click event |
|
public |
Called by wavesurfer when progress should be rendered |
|
public |
Recenter the view-port at a certain percent of the waveform |
|
public |
recenterOnPosition(position: number, immediate: boolean) Recenter the view-port on a position, either scroll there immediately or in steps of 5 pixels |
|
public |
Scroll to the beginning |
|
public |
Set the height of the container |
|
public |
Set the width of the container |
|
public |
|
|
public |
style(el: HTMLElement, styles: Object): HTMLElement Alias of |
|
public abstract |
Called after cursor related params have changed. |
|
public abstract |
updateProgress(position: number) Render the new progress |
|
public abstract |
Called when the size of the container changes so the renderer can adjust |
Inherited Summary
From class Observer | ||
public |
handlers: * |
|
public |
Manually fire an event |
|
public |
on(event: string, fn: function): ListenerDescriptor Attach a handler function for an event. |
|
public |
once(event: string, handler: function): ListenerDescriptor Attach a handler to an event. |
|
public |
setDisabledEventEmissions(eventNames: string[]) Disable firing a list of events by name. |
since 4.0.0 |
public |
Remove an event handler. |
|
public |
unAll() Remove all event handlers. |
Public Constructors
public constructor(container: HTMLElement, params: WavesurferParams) source
Instantiate Observer
Override:
Observer#constructorParams:
Name | Type | Attribute | Description |
container | HTMLElement | The container node of the wavesurfer instance |
|
params | WavesurferParams | The wavesurfer initialisation options |
Public Members
public container: * source
public params: WavesurferParams source
Public Methods
public createWrapper() source
Create the wrapper <wave>
element, style it and set up the events for
interaction
public abstract drawBars(peaks: number[] | Number<Array[]>, channelIndex: number, start: number, end: number) source
Draw a waveform with bars
Params:
Name | Type | Attribute | Description |
peaks | number[] | Number<Array[]> | Can also be an array of arrays for split channel rendering |
|
channelIndex | number | The index of the current channel. Normally should be 0 |
|
start | number | The x-offset of the beginning of the area that should be rendered |
|
end | number | The x-offset of the end of the area that should be rendered |
public drawPeaks(peaks: number[] | Number<Array[]>, length: number, start: number, end: number) source
Draw peaks on the canvas
Params:
Name | Type | Attribute | Description |
peaks | number[] | Number<Array[]> | Can also be an array of arrays for split channel rendering |
|
length | number | The width of the area that should be drawn |
|
start | number | The x-offset of the beginning of the area that should be rendered |
|
end | number | The x-offset of the end of the area that should be rendered |
public abstract drawWave(peaks: number[] | Number<Array[]>, channelIndex: number, start: number, end: number) source
Draw a waveform
Params:
Name | Type | Attribute | Description |
peaks | number[] | Number<Array[]> | Can also be an array of arrays for split channel rendering |
|
channelIndex | number | The index of the current channel. Normally should be 0 |
|
start | number | The x-offset of the beginning of the area that should be rendered |
|
end | number | The x-offset of the end of the area that should be rendered |
public getProgressPixels(wrapperBbox: *, clientX: *): * source
Params:
Name | Type | Attribute | Description |
wrapperBbox | * | ||
clientX | * |
Return:
* |
public handleEvent(e: Event, noPrevent: boolean): number source
Handle click event
Params:
Name | Type | Attribute | Description |
e | Event | Click event |
|
noPrevent | boolean |
|
Set to true to not call |
public progress(progress: number) source
Called by wavesurfer when progress should be rendered
Params:
Name | Type | Attribute | Description |
progress | number | From 0 to 1 |
public recenter(percent: number) source
Recenter the view-port at a certain percent of the waveform
Params:
Name | Type | Attribute | Description |
percent | number | Value from 0 to 1 on the waveform |
public recenterOnPosition(position: number, immediate: boolean) source
Recenter the view-port on a position, either scroll there immediately or in steps of 5 pixels
public setHeight(height: number): boolean source
Set the height of the container
Params:
Name | Type | Attribute | Description |
height | number | The new height of the container. |
public setWidth(width: number): boolean source
Set the width of the container
Params:
Name | Type | Attribute | Description |
width | number | The new width of the container |
public setupWrapperEvents() source
public style(el: HTMLElement, styles: Object): HTMLElement source
Alias of util.style
Params:
Name | Type | Attribute | Description |
el | HTMLElement | The element that the styles will be applied to |
|
styles | Object | The map of propName: attribute, both are used as-is |
public abstract updateProgress(position: number) source
Render the new progress
Params:
Name | Type | Attribute | Description |
position | number | X-Offset of progress position in pixels |
public abstract updateSize() source
Called when the size of the container changes so the renderer can adjust