diff --git a/src/backend/sources/PlayerState/AbstractPlayerState.ts b/src/backend/sources/PlayerState/AbstractPlayerState.ts index a981ccce..3135578a 100644 --- a/src/backend/sources/PlayerState/AbstractPlayerState.ts +++ b/src/backend/sources/PlayerState/AbstractPlayerState.ts @@ -368,7 +368,7 @@ export abstract class AbstractPlayerState { parts.push(`Reported: ${this.reportedStatus.toUpperCase()} | Calculated: ${this.calculatedStatus.toUpperCase()} | Stale: ${this.isUpdateStale() ? 'Yes' : 'No'} | Orphaned: ${this.isOrphaned() ? 'Yes' : 'No'} | Player Updated At: ${todayAwareFormat(this.stateLastUpdatedAt)} | Play Updated At: ${this.playLastUpdatedAt === undefined ? 'N/A' : todayAwareFormat(this.playLastUpdatedAt)}`); let progress = ''; if (this.currentListenRange !== undefined && this.currentListenRange instanceof ListenRangePositional && this.currentPlay.data.duration !== undefined && this.currentPlay.data.duration !== 0) { - progress = `${progressBar(this.currentListenRange.end.position / this.currentPlay.data.duration, 1, 15)} ${formatNumber(this.currentListenRange.end.position, {toFixed: 0})}/${formatNumber(this.currentPlay.data.duration, {toFixed: 0})}s | `; + progress = `${progressBar(this.currentListenRange.end.position / this.currentPlay.data.duration, 1, 15)} ${formatNumber(this.currentListenRange.end.position, {toFixed: 0})}/${formatNumber(this.currentPlay.data.duration, {toFixed: 0})}s Reported | `; } let listenedPercent = ''; if (this.currentPlay !== undefined && this.currentPlay.data.duration !== undefined && this.currentPlay.data.duration !== 0) { @@ -378,6 +378,10 @@ export abstract class AbstractPlayerState { }) } parts.push(`${progress}Listened For: ${formatNumber(this.getListenDuration(), {toFixed: 0})}s ${listenedPercent}`); + if (this.currentListenRange !== undefined && this.currentListenRange instanceof ListenRangePositional && this.currentListenRange.rtTruth) { + const rtProgress = `${progressBar((this.currentListenRange.rtPlayer.getPosition() / 1000) / this.currentPlay.data.duration, 1, 15)} ${formatNumber(this.currentListenRange.rtPlayer.getPosition() / 1000, {toFixed: 0})}/${formatNumber(this.currentPlay.data.duration, {toFixed: 0})}s`; + parts.push(`${rtProgress} Realtime | Drifted ${formatNumber(Math.abs(this.currentListenRange.getDrift() / 1000), {toFixed: 1})}s (Max ${formatNumber(this.currentListenRange.getAllowedDrift() / 1000, {toFixed: 1})})`); + } return parts.join('\n'); } diff --git a/src/backend/sources/PlayerState/ListenRange.ts b/src/backend/sources/PlayerState/ListenRange.ts index 5084d62d..44c692ef 100644 --- a/src/backend/sources/PlayerState/ListenRange.ts +++ b/src/backend/sources/PlayerState/ListenRange.ts @@ -144,6 +144,10 @@ export class ListenRangePositional extends ListenRange { return Math.abs(this.getDrift((position ?? this.end.position))) > this.allowedDrift; } + getAllowedDrift() { + return this.allowedDrift; + } + setRangeEnd(data: ListenProgressPositional | PlayProgressPositional/* , force?: boolean */) { const endProgress = data instanceof ListenProgressPositional ? data : new ListenProgressPositional(data) // if(this.rtTruth) { -- 2.51.2 From 34b0995d6b12a4c3c3c97d3f4e26de4d33d6cc3d Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Mon, 7 Jul 2025 15:04:43 +0000 Subject: [PATCH 2/2] fix(plex): Increase max drift to 35 seconds to account for symfonium lag #271 Symfonium only reports position every 30 seconds vs. plex/plexamp 15 seconds. Increase max drift so MS doesn't falsely seek and reset play state. --- src/backend/sources/PlayerState/PlexPlayerState.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/sources/PlayerState/PlexPlayerState.ts b/src/backend/sources/PlayerState/PlexPlayerState.ts index 61318695..c1629484 100644 --- a/src/backend/sources/PlayerState/PlexPlayerState.ts +++ b/src/backend/sources/PlayerState/PlexPlayerState.ts @@ -6,7 +6,7 @@ import { PositionalPlayerState } from "./PositionalPlayerState.js"; export class PlexPlayerState extends PositionalPlayerState { constructor(logger: Logger, platformId: PlayPlatformId, opts?: PlayerStateOptions) { - super(logger, platformId, {allowedDrift: 17000, rtTruth: true, ...(opts || {})}); + super(logger, platformId, {allowedDrift: 35000, rtTruth: true, ...(opts || {})}); this.gracefulEndBuffer = this.allowedDrift / 1000; }