Repository navigation
fix(parental-lock): close external players on relock, count them as playback, release stalled video - #2256
fix(parental-lock): close external players on relock, count them as playback, release stalled video#2256mahmutyum wants to merge 2 commits into
Conversation
…layback, release stalled video - A relock closes an MPV/VLC session whose media was opened while unlocked when its source has a locked category (any source, when it cannot be told) or the lock store is unreadable. Sessions opened while locked keep playing. Xtream Live claims its own sessions through ParentalLockSessionOwners and keeps closing only withheld categories. A session that could not be closed before an unlock is shown again. - The idle relock counts Embedded MPV while playing and an MPV/VLC film or episode while its reported position moves; players that report no position (live, M3U films, Flatpak MPV) cannot report a pause and do not hold the lock open. - Keep-awake releases a video that stalls without advancing for 60 s and keeps checking one that advanced until playing reports it resumed, so a dead stream no longer pins the display or defers the relock.
[Medium impact] The PR appears safe to merge; no new blocking issues were found. SummaryThe latest changes recover MPV/VLC sessions after a renderer reload so the parental lock can close players left running by the old page.
The previous unnumbered reload-tracking finding is addressed. No new actionable issues were found. Reviews (2) · Last reviewed commit: "fix(parental-lock): close players a relo..." · Reviewed by Greptile |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2256 +/- ##
==========================================
+ Coverage 81.98% 82.00% +0.01%
==========================================
Files 1921 1924 +3
Lines 102911 103089 +178
Branches 24419 25223 +804
==========================================
+ Hits 84376 84539 +163
- Misses 11112 11122 +10
- Partials 7423 7428 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
A renderer reload or crash cleared the tracked sessions while MPV/VLC kept running. The page now reads the open sessions from the main process on start, and treats any session that started before it as opened while unlocked with an unknown source, so the relock rule still closes it.
Summary
Three parental-lock gaps around players that render outside the page, plus one display-sleep leak that also defers the relock.
<video>keep-awake plus<audio>, so a film in those players was cut off after 15 minutes.waitingand neverpause/ended, so the display never slept and the relock stayed deferred.Changes
ParentalLockExternalSessions(apps/web/src/app/services/parental-lock-external-sessions.ts), started by the enforcement service, tracks sessions fromonExternalPlayerSessionUpdate:contentInfo.playlistId, else the source route of the launch; a launch from a global page counts as any source. Sessions carry no category, so this is per source and fails closed. A session opened while locked came from the filtered catalog and keeps playing. A launch first reported after a relock it started before is treated as opened while unlocked.XtreamExternalLiveSessions.enforce:closeExternalPlayerSession(id, true), dock dismissal first, a re-close once a launch has a closer, a 1 s retry on rejection, and the dismissal undone when the app is unlocked before the close lands.listExternalPlayerSessionsbridge,ExternalPlayerSessionRegistry.listOpenSessions()). A session that started before the page counts as opened while unlocked, with an unknown source, so a player left running by a reloaded or crashed renderer is closed under the same rule.ParentalLockSessionOwners(libs/services) lets a feature that knows its sessions' categories claim them. Xtream Live does, so it keeps closing only withheld channels.playing(two with multiview). An MPV/VLC film or episode counts while its reported position moved in the last 15 s, so a pause lets the timer run. Players that report no position (live MPV/VLC, M3U films withoutcontentInfo, Flatpak MPV without the socket bridge) do not count: they cannot report a pause, and a paused window must not keep the app unlocked indefinitely.PlaybackKeepAwakeService: a tracked video that fireswaiting/stalledand does not advancecurrentTimefor 60 s is released. A video that moved is checked again untilplayingreports it resumed, and the nextplayingtracks a released video again.ParentalLockLockStore.hasLocks(playlistId | null).XtreamLiveOwnerhelpers moved toxtream-live-owner.tsand re-exported. This is behaviour-neutral and only keeps the service under the 400-line limit.Docs
docs/architecture/parental-lock.md: new "External players" section, the product rule on playback as interaction, and the Files list.docs/architecture/player-controls-contract.md: stall release under "Display sleep during playback"..changes/parental-lock-external-players.md.Validation
parental-lock-external-sessions.spec.ts,parental-lock-enforcement.service.spec.ts,playback-keep-awake.service.spec.tsparental-lock-lock-store.service.spec.tsxtream-external-live-sessions.service.spec.tsparental-lock-external-player.e2e.ts. Real IPC and session registry, with the MPV process replaced by a quiet child. A session opened while unlocked from a source with a locked category is closed on Lock now. A session opened while locked survives an unlock and the next relock. A player opened while unlocked is closed after a renderer reload. It fails without the fix.DatabaseService browser guardscase fails locally on Node 26; it fails on unmodified master too.parental-lock-pin-dialog2/2, webparental-lock-ui(Chromium) 3/3.typecheck:webandtypecheck:backendclean.release:notes:validateandagents:validatepass.Known limitations