Installation
Install @admmedia/eveplayer from npm:
- npm
- Yarn
- pnpm
npm install @admmedia/eveplayer
yarn add @admmedia/eveplayer
pnpm add @admmedia/eveplayer
This package has no runtime dependencies. video.js and
@videojs/http-streaming (VHS) are both inlined into the shipped bundle
(you do not install them, and no bundler config is needed). VHS is pinned to its
prebuilt sync-workers build and video.js to its VHS-free core.es.js entry,
so no consumer minifier can break VHS's transmuxer worker (see
ADR-0006); the trade-off is that
MPEG-TS segments are transmuxed on the main thread rather than in a Web Worker.
| Package | Version | Bundled from | How it ships |
|---|---|---|---|
video.js | 8.x | video.js/core.es.js | inlined (not a dependency) |
@videojs/http-streaming | 3.x | …-sync-workers.js | inlined (not a dependency) |
Stylesheet
The CSS entry point is shipped separately and must be imported once, anywhere in your app's bundle:
import '@admmedia/eveplayer/style.css';
CDN (no build step)
For a plain HTML page with no bundler, load the pre-built browser bundle from
jsDelivr with a
<script> tag. It self-registers as the EvePlayer global (no import, no
package manager):
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@admmedia/eveplayer/dist/style.css" />
<script src="https://cdn.jsdelivr.net/npm/@admmedia/eveplayer/dist/index.global.js"></script>
<div id="player-container"></div>
<script>
const player = new EvePlayer.EvePlayer(
document.getElementById('player-container'),
{ widescreen: true }
);
player.setSource({
sources: [{ src: 'https://example.com/master.m3u8', type: 'application/x-mpegURL' }],
});
</script>
Everything on the EvePlayer entry point (EvePlayer and the
public types) hangs off that one global. Pin an exact version in the URL for
production (@admmedia/eveplayer@1.0.0/dist/...); the unpinned path above
always resolves to latest, which is fine for a quick try but will move under
you otherwise.
To check which build a page actually loaded (from the console, or in a bug
report), read the static EvePlayer.version (the package.json version baked
in at build time, so a pinned URL and the reported version always agree):
console.log(EvePlayer.EvePlayer.version); // CDN global
import { EvePlayer } from '@admmedia/eveplayer';
console.log(EvePlayer.version); // npm
Browser support
Targets modern evergreen browsers plus Safari (iOS and macOS). See the format support matrix for per-format details.
License
@admmedia/eveplayer is released under the
Apache-2.0 license,
© ADM Media Consulting SA.