Chapters plugin

0.5 KB gzip
@tomato-player/plugin-chapters

Loads chapters from an array or a WebVTT file, draws markers on the seek bar, shows the chapter title in the preview and emits a plugin:chapterchange event.

Hover the seek bar to see the chapter markers and titles.

Install

npm i @tomato-player/plugin-chapters

Usage

player.ts — ts
import { createPlayer } from '@tomato-player/core';
import { minimal } from '@tomato-player/skin-minimal';
import { chapters } from '@tomato-player/plugin-chapters';
​
createPlayer('#player', {
src: 'movie.mp4',
skin: minimal(),
plugins: [chapters({ chapters: '/chapters.vtt' })],
});

Options

OptionTypeDescription
chaptersChapter[] | stringArray of { start, end?, title } or a WebVTT URL.

Other plugins

HotkeysKeyboard shortcuts with familiar defaults, fully remappable.
GesturesDouble-tap to seek on touch, with visual feedback.
ThumbnailsSeek-bar preview thumbnails from WebVTT sprite sheets.
PlaylistNext and previous, auto-advance and loop.
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.