fix(player-stats): exclude paused time from listened duration (#942)

* fix(player-stats): exclude paused time from listened duration

While paused, the Rust engine stops feeding active progress ticks to the
listen session, so the tick baseline (`lastTickMs`) stayed frozen at the
pause point. The first progress tick after resume then computed its
wall-clock delta against that stale timestamp and billed the entire
paused span as listened time, inflating Player stats.

Settle the partial segment played up to the pause and mark the session
paused; the first resumed progress tick rebaselines instead of counting
the gap. Wire the freeze into the single `pause()` transport action.

* docs(changelog): note paused-time player-stats fix (#942)
This commit is contained in:
cucadmuh
2026-06-02 01:50:46 +03:00
committed by GitHub
parent a73e9c4436
commit 5e977cfd49
4 changed files with 67 additions and 1 deletions
+2 -1
View File
@@ -2,7 +2,7 @@ import { invoke } from '@tauri-apps/api/core';
import { setIsAudioPaused } from './engineState';
import type { PlayerState } from './playerStoreTypes';
import { flushQueueSyncToServer } from './queueSync';
import { playListenSessionFinalize } from './playListenSession';
import { playListenSessionFinalize, playListenSessionOnPause } from './playListenSession';
import { pauseRadio, stopRadio } from './radioPlayer';
import { clearAllPlaybackScheduleTimers } from './scheduleTimers';
import { clearSeekDebounce } from './seekDebounce';
@@ -60,6 +60,7 @@ export function createTransportLightActions(set: SetState, get: GetState): Pick<
pause: () => {
clearAllPlaybackScheduleTimers();
playListenSessionOnPause();
if (get().currentRadio) {
pauseRadio();
} else {