Playlist plugin

0.5 KB gzip
@tomato-player/plugin-playlist

Turns the player into a playlist with next, previous, auto-advance and loop. The plugin exposes an API through player.plugin("playlist") and emits plugin:playlistchange.

This player has three items; when one ends the next starts. The playlist demo adds next and previous buttons.

Install

npm i @tomato-player/plugin-playlist

Usage

player.ts — ts
import { createPlayer } from '@tomato-player/core';
import { minimal } from '@tomato-player/skin-minimal';
import { playlist } from '@tomato-player/plugin-playlist';
​
createPlayer('#player', {
src: 'movie.mp4',
skin: minimal(),
plugins: [playlist({ items: [{ src: 'a.mp4', title: 'Intro' }, { src: 'b.m3u8', title: 'Part 2' }], loop: true })],
});

Options

OptionTypeDescription
itemsPlaylistItem[]Items with src, title, poster and tracks.
startnumberIndex to start from (default 0).
autoAdvancebooleanPlay the next item when one ends (default true).
loopbooleanGo back to the first item after the last.

Other plugins

HotkeysKeyboard shortcuts with familiar defaults, fully remappable.
GesturesDouble-tap to seek on touch, with visual feedback.
ChaptersChapters from an array or WebVTT, with seek-bar markers.
ThumbnailsSeek-bar preview thumbnails from WebVTT sprite sheets.
AnalyticsVendor-neutral QoE events: startup time, quartiles, rebuffering, watch time.
Media SessionLock-screen controls, artwork and hardware media keys.
PersistRemember volume, speed, captions and resume position.