This is outdated documentation for wavesurfer.js v6!

Please refer to the new documentaton for the latest version of the library.

Playlist plugin

Adds a playlist capability to wavesurfer.

Quick start

See the Pen WaveSurfer.js - playlist parser plugin by Enton Biba (@entonbiba) on CodePen.

  1. Add the Playlist plugin script tag
  2. Create a WaveSurfer instance
  3. *Create a Playlist instance and use the playlist-ready event

*Create Playlist


  var myPlaylist = wavesurfer.Playlist;
  myPlaylist.init({
    wavesurfer: wavesurfer,
    playlistFile: 'http://linktosupportedplaylistfile.com/playlist.m3u',
    playlistType: 'm3u'
  });    
  

*Return the playlist

The playlist will be available in the playlist-ready event.


    var myList;
      wavesurfer.on('playlist-ready', function () {
      myList = myPlaylist.getPlaylist();
    });  
  

Options

Name Required Default Description
wavesurfer yes A WaveSurfer instance.
playlistFile yes The link to the m3u file.
playlistType no m3u or audio/mpegurl The playlist file type.

Events

Name Description
playlist-ready Invoked when the playlist is ready to use. Use the getPlaylist() method to get the playlist array.