▶ composable-video-player

Composable video player

A PlayerJS-like HTML5 / HLS player in pure TypeScript. Zero runtime dependencies, a declarative JSON layout, CSS-variable theming and a small plugin API. ~30 KB gzipped.

Get started Live demo GitHub

Install

npm

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

createPlayer({
  container: 'player',
  source: '[360p]low.mp4,[720p]high.mp4',
  subtitle: '[English]en.vtt',
});

CDN <script>

<div id="player"></div>
<script src="https://cdn.jsdelivr.net/npm/composable-video-player@0.1/dist/player.umd.js"></script>
<script>
  VP.createPlayer({ container: 'player', source: 'video.mp4' });
</script>

Also on unpkg and, always the latest build, on this site: cdn/player.umd.js.

CDN ES module

<script type="module">
  import { createPlayer } from
    'https://cdn.jsdelivr.net/npm/composable-video-player@0.1/dist/player.js';
  createPlayer({ container: 'player', source: 'stream.m3u8' });
</script>

PlayerJS embeds work too: new Playerjs({ id, file }). See compat.

Features

Documentation

  1. Getting started
  2. Options
  3. Sources
  4. API
  5. Layout
  6. Theming
  7. Plugins
  8. PlayerJS compatibility
  9. CDN and builds