CursorPlugin
Extends:
Implements:
Displays a thin line at the position of the cursor on the waveform.
Example:
// es6
import CursorPlugin from 'wavesurfer.cursor.js';
// commonjs
var CursorPlugin = require('wavesurfer.cursor.js');
// if you are using <script> tags
var CursorPlugin = window.WaveSurfer.cursor;
// ... initialising wavesurfer with the plugin
var wavesurfer = WaveSurfer.create({
// wavesurfer options ...
plugins: [
CursorPlugin.create({
// plugin options ...
})
]
});
Static Method Summary
| Static Public Methods | ||
| public static |
create(params: CursorPluginParams): PluginDefinition Cursor plugin definition factory |
|
Constructor Summary
| Public Constructor | ||
| public |
constructor(params: CursorPluginParams, ws: object) Construct the plugin class. |
|
Member Summary
| Public Members | ||
| public |
The cursor HTML element |
|
| public |
|
|
| public |
The html container that will display the time |
|
| public |
true when |
|
| public |
params: * |
|
| public |
displays the time next to the cursor |
|
| public |
style: * |
|
| public |
util: * |
|
| public |
wavesurfer: * |
|
| public |
wrapper: * |
|
Method Summary
| Public Methods | ||
| public |
destroy() Destroy the plugin (used by the Plugin API) |
|
| public |
formatTime(cursorTime: number): string Format the timestamp for |
|
| public |
Hide the cursor |
|
| public |
init() Initialise the plugin (used by the Plugin API) |
|
| public |
Show the cursor |
|
| public |
updateCursorPosition(xpos: number, ypos: number, flip: boolean) Update the cursor position |
|
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. |
|
Static Public Methods
public static create(params: CursorPluginParams): PluginDefinition source
Cursor plugin definition factory
This function must be used to create a plugin definition which can be used by wavesurfer to correctly instantiate the plugin.
Params:
| Name | Type | Attribute | Description |
| params | CursorPluginParams |
parameters use to initialise the plugin |
Public Constructors
public constructor(params: CursorPluginParams, ws: object) source
Construct the plugin class. You probably want to use CursorPlugin.create
instead.
Override:
Observer#constructorParams:
| Name | Type | Attribute | Description |
| params | CursorPluginParams |
Plugin parameters |
|
| ws | object |
Wavesurfer instance |