Home Reference Source
import RegionsPlugin from 'wavesurfer.js/src/plugin/regions.js'
public class | source

RegionsPlugin

Extends:

Observer → RegionsPlugin

Implements:

Regions are visual overlays on waveform that can be used to play and loop portions of audio. Regions can be dragged and resized.

Visual customization is possible via CSS (using the selectors .wavesurfer-region and .wavesurfer-handle).

Example:

// es6
import RegionsPlugin from 'wavesurfer.regions.js';

// commonjs
var RegionsPlugin = require('wavesurfer.regions.js');

// if you are using <script> tags
var RegionsPlugin = window.WaveSurfer.regions;

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

Static Member Summary

Static Public Members
public static

regions: *

Static Method Summary

Static Public Methods
public static

Regions plugin definition factory

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

list: {}

public

params: *

public

util: *

public
public

wrapper: *

Method Summary

Public Methods
public

add(params: *): *

public

clear()

public
public
public

enableDragSelection(params: *)

public
public

init()

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 Members

public static regions: * source

Static Public Methods

public static create(params: RegionsPluginParams): PluginDefinition source

Regions 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 RegionsPluginParams

parameters use to initialise the plugin

Return:

PluginDefinition

an object representing the plugin

Public Constructors

public constructor() source

Instantiate Observer

Override:

Observer#constructor

Public Members

public list: {} source

public params: * source

public util: * source

public wavesurfer: * source

public wrapper: * source

Public Methods

public add(params: *): * source

Params:

NameTypeAttributeDescription
params *

Return:

*

public clear() source

public destroy() source

public disableDragSelection() source

public enableDragSelection(params: *) source

Params:

NameTypeAttributeDescription
params *

public getCurrentRegion(): * source

Return:

*

public init() source