Home Manual Reference Source Test
import TimelinePlugin from 'wavesurfer.js/src/plugin/timeline.js'
public class | source

TimelinePlugin

Extends:

Observer → TimelinePlugin

Implements:

Adds a timeline to the waveform.

Example:

// es6
import TimelinePlugin from 'wavesurfer.timeline.js';

// commonjs
var TimelinePlugin = require('wavesurfer.timeline.js');

// if you are using <script> tags
var TimelinePlugin = window.WaveSurfer.timeline;

// ... initialising wavesurfer with the plugin
var wavesurfer = WaveSurfer.create({
  // wavesurfer options ...
  plugins: [
    TimelinePlugin.create({
      // plugin options ...
    })
  ]
});

Static Method Summary

Static Public Methods
public static

Timeline plugin definition factory

Constructor Summary

Public Constructor
public

constructor(params: *, ws: *)

Member Summary

Public Members
public

canvases: *[]

public
public

drawer: *

public
public
public

params: *

public
public

util: *

public
public

wrapper: *

Method Summary

Public Methods
public
public
public
public
public

fillRect(x: *, y: *, width: *, height: *)

public

fillText(text: *, x: *, y: *)

public

init()

public
public

render()

public

setFillStyles(fillStyle: *)

public

setFonts(font: *)

public

Inherited Summary

From class Observer
public

fireEvent(event: string, args: ...any)

Manually fire an event

public

Attach a handler function for an event.

public

once(event: string, handler: function): ListenerDescriptor

Attach a handler to an event.

public

un(event: string, fn: function)

Remove an event handler.

public

unAll()

Remove all event handlers.

Static Public Methods

public static create(params: TimelinePluginParams): PluginDefinition source

Timeline 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:

NameTypeAttributeDescription
params TimelinePluginParams

parameters use to initialise the plugin

Return:

PluginDefinition

an object representing the plugin

Public Constructors

public constructor(params: *, ws: *) source

Instantiate Observer

Override:

Observer#constructor

Params:

NameTypeAttributeDescription
params *
ws *

Public Members

public canvases: *[] source

public container: * source

public drawer: * source

public maxCanvasElementWidth: * source

public maxCanvasWidth: * source

public params: * source

public pixelRatio: * source

public util: * source

public wavesurfer: * source

public wrapper: * source

Public Methods

public createCanvases() source

public createWrapper() source

public destroy() source

public drawTimeCanvases() source

public fillRect(x: *, y: *, width: *, height: *) source

Params:

NameTypeAttributeDescription
x *
y *
width *
height *

public fillText(text: *, x: *, y: *) source

Params:

NameTypeAttributeDescription
text *
x *
y *

public init() source

public removeOldCanvases() source

public render() source

public setFillStyles(fillStyle: *) source

Params:

NameTypeAttributeDescription
fillStyle *

public setFonts(font: *) source

Params:

NameTypeAttributeDescription
font *

public updateCanvasStyle() source