@ossplay/player-core
v0.1.1
Published
Framework-agnostic HLS-adaptive video engine (hls.js wrapper) — quality levels, subtitle tracks, error recovery
Readme
@ossplay/player-core
Framework-agnostic adaptive-bitrate video engine — an hls.js
wrapper handling quality levels, subtitle/audio tracks, and error recovery, with automatic fallback
to native HLS (Safari/iOS) or a plain progressive mp4/webm source. No React and no OSSPlay
dependency — attach it to any <video> element yourself.
Building a React app? @ossplay/player wraps this
with a ready-made component.
Install
bun add @ossplay/player-coreUsage
import { PlayerEngine } from "@ossplay/player-core";
const engine = new PlayerEngine(videoElement);
const unsubscribe = engine.subscribe((state) => {
// state.qualityLevels, state.currentLevel, state.subtitleTracks, state.error, ...
});
engine.load([{ src: "https://example.com/video.m3u8", type: "hls" }]);
engine.setLevel(2); // pin a quality level, or "auto" to resume ABR
engine.setSubtitle(0); // or "off"
engine.setAudioTrack(1);
// later:
unsubscribe();
engine.destroy();subscribe fires immediately with the current state, then again on every change.
Docs
Full API reference: ossplay.phuzle.com/docs/helpers/reference/player-engine
License
MIT
