fix: prevent exit countdown on playback blocked
This commit is contained in:
@@ -41,7 +41,7 @@ type PlaybackStatus = "idle" | "playing" | "ended";
|
||||
|
||||
function useExitCountdown(
|
||||
status: PlaybackStatus,
|
||||
composeActive: boolean,
|
||||
disabled: boolean,
|
||||
onExit: () => void,
|
||||
) {
|
||||
const [remainingMs, setRemainingMs] = useState<number | null>(null);
|
||||
@@ -61,7 +61,7 @@ function useExitCountdown(
|
||||
|
||||
// Tick the countdown down (pauses when compose is active)
|
||||
useEffect(() => {
|
||||
if (remainingMs === null || remainingMs <= 0 || composeActive) return;
|
||||
if (remainingMs === null || remainingMs <= 0 || disabled) return;
|
||||
|
||||
const interval = setInterval(() => {
|
||||
setRemainingMs((prev) => {
|
||||
@@ -72,7 +72,7 @@ function useExitCountdown(
|
||||
}, EXIT_TICK_MS);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, [remainingMs !== null && remainingMs > 0, composeActive]);
|
||||
}, [remainingMs !== null && remainingMs > 0, disabled]);
|
||||
|
||||
// Navigate once countdown hits zero
|
||||
useEffect(() => {
|
||||
@@ -237,7 +237,7 @@ function StreamViewInner({ path, streamParticle }: StreamViewProps) {
|
||||
|
||||
const exitRemainingMs = useExitCountdown(
|
||||
status,
|
||||
composeActive,
|
||||
playbackBlocked,
|
||||
handleExitNavigate,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user