perf(playback): keep the history gate off the initial bundle

The `@iptvnator/services` barrel ships in the initial bundle, so adding
PlaybackHistoryGate there (and subscribing to it from the app-wide
ExternalPlaybackService) grew renderer.initialBytes by 1,141 bytes.

- Move the gate to a new lazy-only `playback-data-access` project
  (`@iptvnator/playback/data-access`; scope:shared, domain:playback,
  type:data-access) and register it in the coverage policy.
- The gate subscribes to MPV/VLC session updates itself; it is created by
  the first deferred write, which precedes the launch it waits for.
  ExternalPlaybackService is back to master.
- The Xtream "playlist switched before confirmation" check moves to the
  lazy helper; the initial-path store only takes a `skipListRefresh` flag.

Net effect on this branch: +27 bytes over master (master itself is
108 bytes over the ratchet baseline already).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5.5 committed 2026-09-27 13:41:31 +02:00
1 parent 671a0cb1ec
commit e41bcb9f65
34 files changed
+250 -128

No files matched your search

@@ -1137,9 +1137,9 @@ its stream has really played, so a stream that fails straight away never
reaches history.
- Writers do not persist on selection. They hand the write to
`PlaybackHistoryGate` (`@iptvnator/services`) with `defer(target, commit)`,
where the target is what the playback will be known by: the host's
`playbackSessionKey` (M3U) and/or stream URLs. The Stalker resolver defers
`PlaybackHistoryGate` (`@iptvnator/playback/data-access`) with
`defer(target, commit)`, where the target is what the playback will be
known by: the host's `playbackSessionKey` (M3U) and/or stream URLs. The Stalker resolver defers
by the resolved (possibly temporary) link; the persisted row still stores
the portal `cmd`, never that link. Writers capture the item and its
playlist when they defer, so navigating meanwhile cannot misfile it; an
@@ -1160,9 +1160,11 @@ reaches history.
engine or format swap of the same stream keeps its progress. The radio
`AudioPlayerComponent` confirms the same way (with the host's session key
when given).
- MPV/VLC cannot report whether a live stream plays, so the Electron
`ExternalPlaybackService` confirms a session's `streamUrl` once it is
`opened` or `playing`; a launch that ends in `error` is not recorded. That
- MPV/VLC cannot report whether a live stream plays, so the gate itself
subscribes to the Electron external-player session updates and confirms a
session's `streamUrl` once it is `opened` or `playing`; a launch that ends
in `error` is not recorded. (Subscribing in the gate, which the first
deferred write creates, keeps it off the initial bundle.) That
confirmation carries no session key, so an "Open in MPV/VLC" recovery
launch is also confirmed by the `WebPlayerViewComponent` that requested
it, under its own session key, once the launch has opened. M3U keeps
@@ -189,6 +189,14 @@ other utility projects, including shared interface contracts, while
`ui-playback` and feature hosts may depend on it to render and execute
session-local recovery actions.
`libs/playback/data-access` is the `playback-data-access` Nx project,
imported through `@iptvnator/playback/data-access` (tags `scope:shared`,
`domain:playback`, `type:data-access`). It owns renderer playback state that
store, feature and player layers share — currently `PlaybackHistoryGate`,
which holds "recently viewed" writes until playback is confirmed. It is kept
out of `@iptvnator/services` on purpose: that barrel ships in the initial
bundle, and this project is only reached from lazy player and portal code.
## Project Tags
Every Nx project keeps one tag from each family in `project.json`: