refactor(audio): engine module absorbs the hook

useAudio shrinks 928→152: backend lifecycle, poll, session restore,
crash recovery, queue advance and event-bus commands live in
createAudioEngine; the hook is a thin Solid adapter. audio-player:
preload of a dead URL stalls the load mutex 5s — end-file (open
failure) now races file-loaded.
This commit is contained in:
2026-09-03 08:33:24 -04:00
parent 3e90f9e783
commit ca46de4d70
3 changed files with 928 additions and 823 deletions

View File

@@ -579,8 +579,12 @@ export class MpvBackend implements AudioBackend {
if (pausedSeek) {
// time-pos sent before file-loaded is silently dropped by mpv
// (no file yet) — the preload then parked at 0 and the restore
// position was lost. Wait for the open, then seek.
await fileLoaded;
// position was lost. Wait for the open, then seek. A dead URL
// never fires file-loaded at all (mpv keeps retrying the
// open), so end-file (the open-failure notification) races it
// and the wait folds to "not loaded" instead of stalling the
// load mutex for the full 5s timeout.
await Promise.race([fileLoaded, this.conn?.waitEvent("end-file", 5000)]);
await this.send(["set_property", "time-pos", pausedSeek]);
this._position = pausedSeek;
}