Skip to content
jboixPublic

About

Modular adaptive-streaming engine.

Topics

Resources

Code of conduct

Contributing

Security policy

Accessibility

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

157 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Mattebox

Quality npm version node license: MIT

Mattebox is a modular adaptive-streaming engine for HLS and DASH. It is a small kernel plus stages. You add the stages you need, and the rest stays out of your bundle. It has zero runtime dependencies and uses only MSE, EME, and standard web platform APIs.

Bundle size of adaptive streaming engines, min+gzip, each engine's compatibility build. Mattebox with every stage, transmux worker inside, is 93.7 KB, hls.js 184.1 KB, Shaka Player 267.0 KB, dash.js 297.3 KB.

Quick start

Install the package:

npm install mattebox --save

Create an engine with the stages you need, attach it to a <video> element, and load a manifest.

import { mattebox } from 'mattebox';
import hlsCmaf from 'mattebox/protocols/hls-cmaf';
import abr from 'mattebox/stages/abr';

const engine = mattebox({ stages: [hlsCmaf(), abr()] });

await engine.attach(document.querySelector('video'));
engine.load('https://example.com/stream/master.m3u8');

The element keeps its native API. Call play(), read currentTime, and use the browser controls as usual.

Without a bundler, one script tag loads everything behind a mattebox global with the same API.

<script src="https://cdn.jsdelivr.net/npm/mattebox/dist/cdn/mattebox.min.js"></script>
<script>
  const engine = mattebox({ stages: [mattebox.hlsCmaf(), mattebox.abr()] });
</script>

The guide covers the rest, starting with Getting started.

Player

Mattebox is the engine. Try it in the playground, which lets you load streams and pick stages in the browser. If you want a finished player on top of it, with controls, a theme, and a UI you can customize, use the sibling projects:

Presets

A preset is an engine with a fixed set of stages, exported from mattebox/presets/<name>:

import hls from 'mattebox/presets/hls';

const engine = hls({ config: { bufferGoalSeconds: 40 } });

Every preset plays on demand and live, adapts quality, recovers, switches audio, and renders WebVTT and CEA-608 captions. The name says what it adds: -ts for MPEG-TS segments, -drm for protected content.

Preset Line MPEG-TS DRM
hls HLS
hls-drm HLS yes
hls-ts HLS yes
hls-ts-drm HLS yes yes
dash DASH
dash-drm DASH yes
dual HLS + DASH
dual-drm HLS + DASH yes
dual-ts HLS + DASH yes
dual-ts-drm HLS + DASH yes yes
hls-ll LL-HLS
dash-ll LL-DASH
dual-ll LL-HLS + LL-DASH
full LL-HLS + LL-DASH yes yes
kernel none

full is the Mattebox bar in the chart above. See Size per preset for the others.

Documentation

  • Guide: how to use the engine, one chapter per topic.
  • Architecture: how the engine is built, how a stage plugs in, and the decisions behind it.
  • Stability: what you can rely on before 1.0, and what 1.0 promises.
  • Playground: try streams and stages in the browser.

Contributing

See the contributing guide. Participation is governed by the Code of Conduct. Vulnerabilities go through SECURITY.md. Barriers for people with disabilities go through the accessibility statement.

The node and Chromium test tiers cover 93% of the lines in src/ (2026-10-16). CI fails below 91%.

License

MIT, see LICENSE.

About

Modular adaptive-streaming engine.

Topics

Resources

Code of conduct

Contributing

Security policy

Accessibility

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages