Skip to content

Discord keeps showing "Playing" with a running timer for up to 5 minutes after the player closes #1099

Description

@rowkav09

When a player is closed without a clean stop (Plexamp closed here), the media server keeps reporting the session as playing with a frozen position. The Discord loop only reacts through the stuck rule in src/discord-presence.js, which clears after stuckAfterMs (5 minutes). Until then it republishes the session as a live "Playing" activity with start/end timestamps, so Discord keeps advancing the progress bar even though the position stopped. Screenshot from a Plexamp user: card still reads "Playing 04:10 / 04:52" after Plexamp was closed.

Repro (existing test harness style, see test/discord-presence.test.js): feed createDiscordPresenceLoop a playing presence whose positionMs stops changing. Every tick up to 300s publishes the live activity with startTimestamp/endTimestamp, then it clears.

Expected: once the position has not moved for a short while (45s, three polls at the default interval), show the session as stopped at that position (no running timer, "Paused" label) and keep the existing 5 minute clear. Playback that moves again gets its timer back.

Fix: a stallAfterMs option (default 45000, always below stuckAfterMs) in the Discord loop. A stalled item is published through the frozen-timestamps controller with state paused. Test added in test/discord-presence.test.js; fails on current main.

The hosted card loop uses the same stuck rule and has the same 5 minute window; not changed here.

Priority: Medium.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions