Public API
PlayerFacade
| Method or stream |
Usage |
Notes |
attach |
Associates an HTMLVideoElement with the runtime. |
Receives plugins, config, ports, and engine factories. |
load |
Loads a PlayerConfig or source. |
Engine selection, sidecars, tracks, and loading state. |
play / pause |
Playback control. |
Promises compatible with browser policies. |
seekTo |
Sets playback position. |
Must respect live and engine constraints. |
setVolume / setMuted |
Audio control. |
Stable surface for UI. |
setAudioTrack / setTextTrack |
Track selection. |
Depends on active engine capabilities. |
setPlaybackRate |
Playback speed. |
VOD, courses, podcasts, or review. |
snapshot |
Instant state. |
Synchronous read for UI and diagnostics. |
state$ / events$ |
Observable streams. |
Source for Angular integrations, telemetry, and plugins. |
Direct Runtime with Shaka
import { createDefaultConfig, PlayerFacade } from "@ngxsp/core";
import { createShakaEngineFactory } from "@ngxsp/engine-shaka";
const config = createDefaultConfig({
source: {
type: "hls",
url: "https://example.com/master.m3u8",
contentId: "movie-42"
},
subtitles: { enabled: true, providers: ["local"], preferredLang: "fr" }
});
const facade = new PlayerFacade();
facade.attach(videoEl, [], config, undefined, [createShakaEngineFactory()]);
await facade.load(config);