Skip to content

mpv hand-off: in-flight MPV state (pending play, played video, last send, error badge) is lost when the event page unloads #158

Closed

Description

@Nawid3333

Severity: low

Where: chrome/background/TabTracker.mjs (PersistedTabFields = ['url', 'isOn', 'isMpv', 'mpvOnPlay', 'regexMatched', 'mpvMatched', 'mpvAutoOpened']), chrome/background/background.mjs (onUserPlay sets tab.mpvPlayedVideo and tab.mpvPlayPendingUntil; sendPlayedToMpv sets tab.mpvLastPlaySend; setMpvError sets tab.mpvError)

What happens

CLAUDE.md's own rule is "A new field that has to survive a wake goes into PersistedTabFields", and these four do not. In shortcut MPV mode the user presses play on a player that fetches its manifest only afterwards; if the background is stopped inside the 15 s window (no extension page is open on such a tab to keep it alive), the pending play is forgotten and the stream is only tracked, nothing goes to mpv; the user presses play again. A lost mpvError means the "!" badge disappears after a restart with the failure unresolved.

Suggested fix

Persist mpvPlayPendingUntil, mpvPlayedVideo, mpvLastPlaySend and mpvError (plain JSON values), saving where they change.

Confidence: high on the code; low on how often the unload lands inside the window.


From a line-by-line code review of the tree at 41363fd (2026-10-02). Each claim above was checked against the source before filing; the reproduction steps and line references are as of that commit.


Generated by Claude Code

Activity

  1. added
    bugSomething isn't working
    code-reviewFound by the 2026-10-02 line-by-line review
    on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcode-reviewFound by the 2026-10-02 line-by-line review

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions