Establish a decoupled player boundary so UI and backend interact with video through one contract, with the HTML5 (Linux/interim-Android) and native (ExoPlayer) providers as interchangeable primitive-executor adapters. - PlayerAdapter interface + AdapterHost callback bag (adapters/types.ts): the adapter owns only decision-free element PRIMITIVES (seekElement, reloadSource, play/pause, setVolume, selectSubtitle); it never branches on strategy. - Seek/audio-track DECISIONS stay in Rust (player_seek_video / _switch_audio_track return a strategy); the facade dispatches the chosen primitive to the active adapter. Both providers share the one decision path — logic lives once, in Rust. - Facade holds the active adapter; a new ControlCommand PlayerStatusEvent lets backend control (lockscreen/remote/sleep) drive the webview <video> element. - Html5PlayerAdapter resolves the LIVE element via the bridge (fixes play/pause silently no-opping when the element was re-bound). - Do not emit a "stopped" player state on natural end-of-video: it flipped the player/mode to idle mid-handoff and suppressed next-episode auto-advance under a sleep timer. Jellyfin progress reporting is preserved; the backend's on_video_playback_ended owns the transition. - VideoPlayer net -300 lines (strategy/HLS-reload logic relocated to the adapter). - Adds 20 adapter unit tests; existing suites stay green (vitest 457, cargo 416). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
20 lines
698 B
TypeScript
20 lines
698 B
TypeScript
/**
|
|
* Compatibility shim.
|
|
*
|
|
* The HTML5 → Rust reporting functions moved to `adapters/rustReportHost.ts` as
|
|
* part of the PlayerAdapter refactor. Existing callers import the reporter as
|
|
* `import * as html5Adapter from "$lib/player/html5Adapter"`; this shim keeps
|
|
* that working while the migration proceeds. New adapter code should depend on
|
|
* the `AdapterHost` interface (see `adapters/types.ts`) instead.
|
|
*/
|
|
|
|
export {
|
|
reportState,
|
|
reportPosition,
|
|
reportMediaLoaded,
|
|
resetReporting,
|
|
} from "./adapters/rustReportHost";
|
|
|
|
/** @deprecated states are defined on the AdapterHost interface now. */
|
|
export type Html5PlayerState = "playing" | "paused" | "loading" | "stopped" | "idle";
|