mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 14:35:41 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user