Skip to content

Navigation Menu

Sign in
Sign up

Latest commit

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

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 51.6 KB, hls.js 184.1 KB, video.js with VHS built in 197.3 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.

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. 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
full HLS + 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 and how a stage plugs in.
  • 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.

License

MIT, see LICENSE.

About

Modular adaptive-streaming engine.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /