Skip to content

About

🍅 One player. A thousand possibilities. Modular, accessible, SSR-safe web video player with swappable skins, plugins, HLS/DASH and React/Vue/Svelte bindings.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

47 Commits

Folders and files

Repository files navigation

Tomato Player logo

Tomato Player

One player. A thousand possibilities.

A modular, accessible, SSR-safe video player ecosystem for the web.
A tiny core, swappable skins, community plugins, HLS/DASH on demand, and first-class React, Vue, Svelte and HTML support.

CI License: MIT core 5.7 KB gz full player 15.7 KB gz TypeScript a11y

🌐 Website · ▶ Skin gallery · 🎬 Demos · 🧪 Playground · 📚 Docs · Research · llms.txt

The nine Tomato Player skins: Minimal, Cinema, Studio, Creator, Learn, Campus, Stream, Tube and Feed

Why Tomato Player?

Picking a web video player usually means choosing between a heavy all-in-one (big bundle, hard to restyle), a pretty but abandoned project, or a headless toolkit where you build every control yourself. Tomato Player is designed around the problems developers actually report (research):

Pain point What Tomato Player does
Bundle bloat The core is 5.7 KB gz, and core + UI + Minimal skin is about 15.7 KB gz. hls.js and dash.js are optional peers, loaded with import() only when a stream needs them, and never on Safari, which plays HLS natively.
SSR / hydration crashes Zero work at import time: no package touches window until createPlayer() runs. The React binding is tested with renderToString and Strict Mode.
Restyling is painful Skins are swappable packages: state lives in data-* attributes, design tokens in CSS variables, and you can change skins at runtime with player.setSkin().
Memory leaks in SPAs Every listener is bound to an AbortSignal. destroy() is idempotent and restores the DOM exactly.
iPhone fullscreen hides your UI fullscreenFallback: 'pseudo' keeps your skin on iOS.
Poor accessibility Real buttons, sliders with aria-valuetext, keyboard menus, focus rings, reduced-motion and forced-colors support. Tests assert every control has a name.
Abandoned libraries Plyr is deprecated and Vidstack is security-only. See the migration guides.

Quick start

The npm packages are not published yet (npm i returns 404). Until then, load it from jsDelivr:

<script src="https://cdn.jsdelivr.net/gh/playlikeboy/tomato-player@cdn/tomato-player.global.js"></script>

See the CDN guide for ES modules and import maps.

After the first npm release:

npm i @tomato-player/core @tomato-player/skin-minimal
import { createPlayer } from '@tomato-player/core';
import { minimal } from '@tomato-player/skin-minimal';

const player = createPlayer('#player', {
  src: 'https://example.com/movie.mp4',
  poster: 'https://example.com/poster.jpg',
  title: 'My movie',
  skin: minimal(),
});

player.on('ended', () => console.log('🍅 done'));

No build step

<script src="https://cdn.jsdelivr.net/gh/playlikeboy/tomato-player@cdn/tomato-player.global.js"></script>

<tomato-player src="movie.mp4" poster="poster.jpg" title="My movie" skin="cinema" accent="#f59e0b">
  <track kind="captions" src="en.vtt" srclang="en" label="English" />
</tomato-player>

Also on unpkg (https://unpkg.com/tomato-player) and as browser ESM (https://esm.sh/tomato-player). The all-in CDN build ships every skin and plugin in about 26 KB gz.

React · Vue · Svelte

import { TomatoPlayer } from '@tomato-player/react';
<TomatoPlayer src="movie.mp4" skin={skin} plugins={plugins} onReady={(p) => p.play()} />
<TomatoPlayer src="movie.mp4" :skin="skin" @ready="onReady" />
<div use:tomato={{ src: 'movie.mp4', skin }} />

Angular, Astro, Solid, Lit and anything else that renders HTML can use import 'tomato-player/element' and the <tomato-player> web component. See Frameworks.

Streaming

npm i @tomato-player/provider-hls hls.js
import { hls } from '@tomato-player/provider-hls';
createPlayer('#player', { src: 'https://example.com/master.m3u8', providers: [hls()] });

Adaptive quality, audio tracks, live/DVR and error recovery are built in. DASH works the same way with @tomato-player/provider-dash. For DRM, see Streaming.

Skins

Every skin is its own package (0.6–2.7 KB gz), is themeable with tokens, and can be swapped at runtime.

Skin Built for
Minimal
@tomato-player/skin-minimal
Clean, lightweight default
Cinema
@tomato-player/skin-cinema
Premium storytelling: serif titles, gold gradient
Studio
@tomato-player/skin-studio
Pros: SMPTE timecode, frame stepping, A-B loop
Creator
@tomato-player/skin-creator
Expressive: floating glass pill, gradients, cast
Learn
@tomato-player/skin-learn
Courses: speed chips, ±10 s, chapter panel, big captions
Campus
@tomato-player/skin-campus
Ported from the CampusLoop landing page: paper sticker strip, sticker captions, tap to unmute, 9:16 on phones
Stream (unofficial)
@tomato-player/skin-stream
Streaming-service patterns, next-episode flow
Tube (unofficial)
@tomato-player/skin-tube
Video-platform patterns, theater mode
Feed (unofficial)
@tomato-player/skin-feed
Social-feed patterns: muted autoplay in view
cinema({ eyebrow: 'Original', tokens: { accent: '#38bdf8', radius: '0px' } });

Want to build skin #10? Run pnpm new skin <name>. See Create a skin. The long-term goal is a searchable gallery of 1,000+ community skins.

Plugins

Plugin gz
plugin-hotkeys 0.9 KB YouTube-style shortcuts, remappable, never hijacks inputs
plugin-gestures 0.8 KB Double-tap to seek with ripples
plugin-chapters 0.5 KB Array or WebVTT, seek-bar markers, chapter titles in preview
plugin-thumbnails 0.5 KB WebVTT sprite previews
plugin-playlist 0.5 KB Next/previous, auto-advance, loop
plugin-analytics 0.8 KB Vendor-neutral QoE: startup time, rebuffering, watch time, quartiles
plugin-media-session 0.6 KB Lock-screen controls and media keys
plugin-persist 0.7 KB Remembers volume, speed and captions, and resumes position

Plugins communicate through provide/inject. For example, the time slider shows thumbnails and chapter titles from any plugin that provides them.

Packages

Package Description
@tomato-player/core Engine: state store, typed events, providers, skins, plugins, i18n
@tomato-player/ui Accessible control primitives, original icons, base CSS, createSkin()
@tomato-player/provider-hls · -dash Lazy streaming engine adapters
@tomato-player/react · vue · svelte Framework bindings (≤ 0.6 KB gz)
tomato-player Everything: <tomato-player> element, CDN/IIFE build
@tomato-player/skin-* · @tomato-player/plugin-* See above

Architecture in 20 seconds

<video>  ──native events──▶  core store  ──data-* attributes──▶  skin CSS
   ▲                            │  ▲
   │ attach                     │  │ provide / inject
provider (native · hls · dash)  ▼  │
                            skins · plugins · your UI

The <video> element stays the single source of truth. Read Architecture for details.

Playground

Try it online: https://playlikeboy.github.io/tomato-player/playground/. Every skin is also playable side by side in the skin gallery, and every feature has a live demo.

Or run it locally:

git clone https://github.com/playlikeboy/tomato-player && cd tomato-player
pnpm install && pnpm playground
# open http://localhost:5173/examples/playground/

Switch skins, sources (progressive and HLS), accent colors and plugins live, watch the event log, and copy the generated code.

Documentation

Read it on the website (with search), or browse the Markdown here. It is Markdown-first, so it works on GitHub, in editors and in AI assistants:

Contributing

Skins, plugins, providers, translations, docs and bug reports are all welcome.

pnpm install
pnpm run check   # build, typecheck, test, validate manifests, size budgets
pnpm site:dev    # run the website (apps/website) locally
pnpm new skin aurora "My first skin"

Read CONTRIBUTING.md. Every package is validated automatically (naming, exports, scoped CSS, peer-only engines, size budget), so reviews stay focused on design and behavior.

Credits and license

MIT © Tomato Player contributors.

  • Streaming engines are optional peer dependencies under their own licenses: hls.js (Apache-2.0) and dash.js (BSD-3-Clause). See THIRD_PARTY_NOTICES.md.
  • Ideas we learned from and gratefully acknowledge: Video.js, Vidstack, Media Chrome, Plyr, Artplayer and the hls.js, dash.js and Shaka teams.
  • Demo media: Big Buck Bunny © Blender Foundation, CC BY 3.0. HLS test stream by Mux.
  • Trademarks: the Stream, Tube and Feed skins are unofficial designs inspired by common interaction patterns. They contain no logos, fonts or assets of Netflix, YouTube/Google or Meta/Facebook, and Tomato Player is not affiliated with or endorsed by those companies.

About

🍅 One player. A thousand possibilities. Modular, accessible, SSR-safe web video player with swappable skins, plugins, HLS/DASH and React/Vue/Svelte bindings.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages