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.
When a player is closed without a clean stop (Plexamp closed here), the media server keeps reporting the session as
playingwith a frozen position. The Discord loop only reacts through the stuck rule insrc/discord-presence.js, which clears afterstuckAfterMs(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): feedcreateDiscordPresenceLoopaplayingpresence whosepositionMsstops changing. Every tick up to 300s publishes the live activity withstartTimestamp/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
stallAfterMsoption (default 45000, always belowstuckAfterMs) in the Discord loop. A stalled item is published through the frozen-timestamps controller with statepaused. 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.