Playlist

plugin

Three items with next, previous and auto-advance, driven by the plugin API.

Up next
Big Buck Bunny © Blender Foundation, CC BY 3.0, via Wikimedia Commons. HLS test stream by Mux, DASH by Akamai.

The code

tsx
import { playlist } from '@tomato-player/plugin-playlist';
import { hls } from '@tomato-player/provider-hls';
​
const player = createPlayer('#player', {
skin: stream({ onNext: () => player.plugin('playlist').next() }),
providers: [hls()],
plugins: [
playlist({
items: [
{ src: 'bunny.webm', title: 'Big Buck Bunny' },
{ src: 'tears-of-steel.m3u8', title: 'Tears of Steel' },
{ src: 'bunny.m3u8', title: 'Big Buck Bunny (HLS)' },
],
loop: true,
}),
],
});
​
player.on('plugin:playlistchange', ({ index }) => console.log('now playing', index));