Brightcove Player Playlist UI Plugin v5.1.0

The Brightcove Player Playlist UI Plugin v5.1.0 is available.

Features

Add/Remove Playlist Items

The plugin now supports adding and removing playlist item(s) individually instead of only allowing complete replacement of the entire playlist.

When items are added or removed, the playlist UI will only update the affected items.

This change introduces the add and remove methods of the playlist object. And it adds two new events - playlistadd and playlistremove.

These methods and events were introduced via the underlying open source videojs-playlist plugin, which is bundled into this plugin. You can refer to the open source documentation for specifics, but here is an example of how these new methods might be used:

var samplePlaylist = [{
  sources: [{
    src: 'aaa.mp4',
    type: 'video/mp4'
  }]
}];

player.playlist(samplePlaylist);

// Log the playlistadd and playlistremove events
player.on('playlistadd', 'playlistremove', ({count, index, type}) => {
  player.log(`saw ${type} event`, count, index);
  player.log(`playlist total length is now ${player.playlist().length}`);
});

// Adding one item to a playlist.
// Playlist will contain two items after this call: aaa.mp4, bbb.mp4
player.playlist.add({
  sources: [{
    src: 'bbb.mp4',
    type: 'video/mp4'
  }]
});

// Adding multiple items to a playlist at index 1.
// Playlist will contain four items after this call: aaa.mp4, ccc.mp4, ddd.mp4, and bbb.mp4
player.playlist.add([{
  sources: [{
    src: 'ccc.mp4',
    type: 'video/mp4'
  }]
}, {
  sources: [{
    src: 'ddd.mp4',
    type: 'video/mp4'
  }]
}], 1);

// Removing a single item from a playlist.
// Playlist will contain three items after this call: ccc.mp4, ddd.mp4, and bbb.mp4
player.playlist.remove(0);

// Removing multiple items from a playlist.
// Playlist will contain one item after this call: bbb.mp4
player.playlist.remove(1, 2);