mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-04-05 01:09:46 +00:00
fix duplicate trakt entries while pausing and resuming content
This commit is contained in:
parent
77ce6568d7
commit
1cadc2473f
1 changed files with 7 additions and 1 deletions
|
|
@ -210,6 +210,11 @@ export const useWatchProgress = (
|
|||
wasPausedRef.current = paused;
|
||||
if (becamePaused) {
|
||||
void saveWatchProgress();
|
||||
} else {
|
||||
// Became unpaused — open/re-open the Trakt scrobble session
|
||||
if (durationRef.current > 0) {
|
||||
void traktAutosyncRef.current.handlePlaybackStart(currentTimeRef.current, durationRef.current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -238,7 +243,8 @@ export const useWatchProgress = (
|
|||
setTimeout(() => {
|
||||
if (id && type && durationRef.current > 0) {
|
||||
saveWatchProgress();
|
||||
traktAutosync.handlePlaybackEnd(currentTimeRef.current, durationRef.current, 'unmount');
|
||||
// Use ref to avoid stale closure capturing an old traktAutosync instance
|
||||
traktAutosyncRef.current.handlePlaybackEnd(currentTimeRef.current, durationRef.current, 'unmount');
|
||||
}
|
||||
}, 0);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue