Plugins
How to configure a plugin
To start using a plugin, you need to insert the plugin library into your HTML page, alongside wavesurfer.js
, like this:
<script src="https://unpkg.com/wavesurfer.js"></script>
<script src="https://unpkg.com/wavesurfer.js/dist/plugin/wavesurfer.regions.min.js"></script>
You need to include the plugin's configuration when creating an instance of WaveSurfer
:
var wavesurfer = WaveSurfer.create({
container: '#waveform',
plugins: [
WaveSurfer.regions.create({})
]
});
If you are using the NPM package with Webpack or another bundler,
the plugins are installed in node_modules
with
the wavesurfer.js package, but they must first be imported
or required locally in order to use them:
// ES6: import RegionsPlugin from "wavesurfer.js/dist/plugin/wavesurfer.regions.min.js";
var RegionsPlugin = require("wavesurfer.js/dist/plugin/wavesurfer.regions.min.js");
var wavesurfer = WaveSurfer.create({
container: '#waveform',
plugins: [
RegionsPlugin.create({})
]
});
Plugins
-
Regions plugin
Adds ability to display and interact with audio regions. Regions are visual overlays that can be resized and dragged around the waveform. You can play back and loop a region.
-
Timeline plugin
Adds a nice simple timeline to your waveform. By Instajams.
-
Microphone plugin
Visualizes audio input from a microphone. By Thijs Triemstra.
-
Minimap plugin
Adds a minimap preview of your waveform. By Enton Biba.
-
Playlist plugin
Adds a playlist feature to your waveform. By Enton Biba.
-
Cursor plugin
Shows a cursor on your waveform.
-
Spectrogram plugin
Shows a spectrogram for your waveform.
-
Markers plugin
Shows markers for your waveform.