npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

composable-video-player

v0.1.0

Published

Composable, extensible PlayerJS-like HTML5/HLS video player in pure TypeScript. Zero runtime dependencies.

Readme

composable-video-player

npm license: MIT CI

An HTML5/HLS video player in TypeScript with no runtime dependencies. It has a typed API, a plugin system, and a UI you describe as a JSON layout. It reads the PlayerJS source syntax ([720p]url,[1080p]url, {English}url;{French}url, a or b, …) and includes a drop-in new Playerjs({...}) facade. Qualities, audio tracks, subtitles, thumbnails, playlists, hotkeys, and memory are plugins you can replace or extend. hls.js is loaded on demand, and only for HLS.

Documentation · Live demo · PlayerJS compat demo

Install

npm install composable-video-player

Or from a CDN:

<!-- script tag: window.VP and window.Playerjs -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/player.umd.js"></script>

<!-- ES module -->
<script type="module">
  import { createPlayer } from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/player.js';
</script>

The CSS is bundled and injected automatically.

Examples

Typed API (bundler)

import { createPlayer } from 'composable-video-player';

const player = createPlayer({
  container: 'player', // element id or HTMLElement
  source: '[360p]https://cdn.example.com/v360.mp4,[720p]https://cdn.example.com/v720.mp4',
  title: 'My video',
  subtitle: '[English]https://cdn.example.com/en.vtt',
  thumbnails: 'https://cdn.example.com/thumbs.vtt',
});

player.on('time', (t) => console.log(t));
player.command('setQuality', 0);
player.command('seek', '+10');

Script tag (UMD)

<div id="player"></div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/player.umd.js"></script>
<script>
  var player = VP.createPlayer({ container: 'player', source: 'https://cdn.example.com/video.m3u8', theme: { color1: '#e11d48' } });
</script>

PlayerJS compatible

<div id="player"></div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/player.umd.js"></script>
<script>
  function PlayerjsEvents(event, id, data) { if (event === 'end') console.log('done'); }
  var player = new Playerjs({ id: 'player', file: '//cdn.example.com/video.m3u8', default_quality: 'max' });
  player.api('seek', '+10');
</script>

Features

  • MP4/WebM and HLS: hls.js is lazy-loaded from jsDelivr (pinned, with SRI) where MSE exists, and native HLS is used on iPhone. Self-hosting is supported.
  • PlayerJS source syntax: qualities, audio tracks, or fallbacks, and random pick, [seek:N], inline subtitles. JSON/URL playlists with folders.
  • Typed commands, events, and reactive state (player.select), plus the string api() of PlayerJS.
  • Plugins: quality, speed, audio tracks, subtitles (WebVTT/SRT), sprite thumbnails, playlist, hotkeys, memory, autoplay with muted fallback, and Media Session. Write your own with typed options and commands.
  • Declarative JSON layout: anchors, hide rules, click actions, text templates, and a headless mode (layout: false).
  • Theming with CSS variables or the theme option (light themes included), replaceable icons, and English/Russian UI with per-key overrides.
  • Timeline markers (state.markers) for chapters and ad breaks.
  • PlayerJS facade: new Playerjs, PlayerjsEvents, DOM events, PlayerjsAsync, and an iframe postMessage bridge with an origin check.
  • No runtime dependencies. About 33 KB (ESM) / 29 KB (UMD) gzipped, CSS included.

Documentation

  1. Getting started: install, quick start, CDN, sizing, browser support
  2. Options: every PlayerOptions field, core and plugin
  3. Sources: source syntax, SourceSpec, playlists, HLS, subtitles, thumbnails
  4. API: methods, commands, events, state
  5. Layout: components, shared props, hide rules, actions, headless mode
  6. Theming: CSS variables, class hooks, icons, i18n
  7. Plugins: built-in plugins, writing plugins, markers, worked examples
  8. PlayerJS compatibility: options mapping, api(), events, postMessage
  9. CDN and builds: which file to use, version pinning, self-hosting, CSP

The Markdown sources are in docs/guide/.

Development

npm install
npm run assets   # generate demo media (needs ffmpeg)
npm run dev      # demo at http://localhost:5173
npm test && npm run typecheck
npm run build    # dist/player.js (ESM), dist/player.umd.cjs + dist/player.umd.js (UMD), dist/types
npm run check:types-consumer  # typecheck the packed typings from a nodenext/bundler consumer
npm run site     # build the GitHub Pages site (docs, demo, cdn/) into site/

Relative imports carry explicit .js extensions. tsconfig.json uses NodeNext resolution, so a missing extension fails the typecheck.

License

MIT