the player chrome can actually hide now
The auto-hide timer was there and correct; `position` was in its dependency list. That advances about four times a second while a video plays, so the effect re-ran and cleared the pending timeout every ~250ms and the 2.5s never elapsed. The chrome could only hide while playback was stopped — which is exactly when the code deliberately keeps it up — so in practice it never hid at all. Not a fullscreen bug, though fullscreen is where a permanent scrubber is impossible to ignore. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -255,11 +255,16 @@ export const VideoPlayer = ({ id }: { id: string }) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Auto-hide, but never while paused — a paused player with no controls looks broken rather than clean.
|
// Auto-hide, but never while paused — a paused player with no controls looks broken rather than clean.
|
||||||
|
//
|
||||||
|
// `position` must NOT be a dependency, however much it reads like activity. It advances ~4x a second from
|
||||||
|
// onTimeUpdate, so naming it here re-ran this effect — and so cleared the pending timer — long before 2.5s
|
||||||
|
// had passed. The chrome could then only hide while playback was stopped, which is to say never. Real
|
||||||
|
// activity is `wake()`, which sets `chrome` back to true and restarts the timer through the dep below.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!chrome || !playing) return;
|
if (!chrome || !playing) return;
|
||||||
const timer = setTimeout(() => setChrome(false), CHROME_HIDE_MS);
|
const timer = setTimeout(() => setChrome(false), CHROME_HIDE_MS);
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}, [chrome, playing, position]);
|
}, [chrome, playing]);
|
||||||
|
|
||||||
const seek = useCallback(
|
const seek = useCallback(
|
||||||
(seconds: number) => {
|
(seconds: number) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user