fix(player): the playing film restarts in place; arrows stay the volume; the bands' holds end
- The info overlay's collection strip listing the film itself: Play/Restart restart or resume it in place instead of pausing it on a frozen 0:00. - Up/Down on the closed ⋯ and tracks buttons stay the volume (openOnArrowKey: false). - A keyboard focus in the bands holds them for 10 s after the last key, not the whole film; a tap leaving a tapped button no longer re-shows the bands its own toggle then hid. - Next leaving under the focus hands it to its neighbour (the player keeps its focus). - The chosen audio / subtitle track wears the MenuCheck tick.
This commit is contained in:
@@ -73,12 +73,17 @@ export function useFullscreen(wrapRef: RefObject<HTMLElement | null>): {
|
||||
// `holdOnHover` is the pointer resting on the chrome: the bar stays while it is there (as on YouTube
|
||||
// and Plex Web — E28 F22, it used to fade out from under a mouse parked on Next), and leaving it
|
||||
// starts a fresh 3 s. `holdOnFocus` is the same for a KEYBOARD focus in the chrome (E28 review E6): the
|
||||
// bar must not fade from under the control a key user is on.
|
||||
// bar must not fade from under the control a key user is on — but only for a while after the last
|
||||
// key (FOCUS_HOLD_MS). The focus never leaves the bands on its own (Escape hands it back to the ⋯), so
|
||||
// a hold without an end kept them over the whole film (round 2, P4); any key wakes them again.
|
||||
//
|
||||
// On touch (C3) nothing moves a mouse, so the timer is also armed by PLAYBACK starting — before, the
|
||||
// bar stayed up until the first tap however long the video played — and a tap on the picture only
|
||||
// shows or hides the bar (`toggle`), never pauses. `show(false)` hides at once: a double-tap skip
|
||||
// takes back the show/hide its first tap did.
|
||||
const HIDE_MS = 3000;
|
||||
const FOCUS_HOLD_MS = 10_000;
|
||||
|
||||
export function useControlsVisibility(opts: {
|
||||
barAutoHideRef: RefObject<boolean>;
|
||||
menuOpenRef: RefObject<boolean>;
|
||||
@@ -105,11 +110,17 @@ export function useControlsVisibility(opts: {
|
||||
setVisible(true);
|
||||
if (hideTimer.current) window.clearTimeout(hideTimer.current);
|
||||
if (!barAutoHideRef.current) return; // per-user setting: never auto-hide the control bar
|
||||
hideTimer.current = window.setTimeout(() => {
|
||||
// Keep the controls up while the audio/subtitle menu is open, else it would vanish mid-choice.
|
||||
if (!videoRef.current?.paused && !menuOpenRef.current && !hovered.current && !focused.current)
|
||||
const wokeAt = Date.now();
|
||||
const arm = (ms: number) => {
|
||||
hideTimer.current = window.setTimeout(() => {
|
||||
// Keep the controls up while the audio/subtitle menu is open, else it would vanish mid-choice.
|
||||
if (videoRef.current?.paused || menuOpenRef.current || hovered.current) return;
|
||||
const held = FOCUS_HOLD_MS - (Date.now() - wokeAt);
|
||||
if (focused.current && held > 0) return arm(held);
|
||||
setVisible(false);
|
||||
}, 3000);
|
||||
}, ms);
|
||||
};
|
||||
arm(HIDE_MS);
|
||||
}, [barAutoHideRef, menuOpenRef, videoRef, setVisible]);
|
||||
const show = useCallback(
|
||||
(visible: boolean) => {
|
||||
@@ -130,8 +141,12 @@ export function useControlsVisibility(opts: {
|
||||
);
|
||||
const holdOnFocus = useCallback(
|
||||
(on: boolean) => {
|
||||
const was = focused.current;
|
||||
focused.current = on;
|
||||
if (!on) wake();
|
||||
// Only a hold that ENDS restarts the timer. A tap moving the focus out of the bands (a finger
|
||||
// never holds: its focus is not :focus-visible) re-showed them on its way to the picture, whose
|
||||
// own toggle then hid them again — the tap did nothing on Android (round 2, P3).
|
||||
if (was && !on) wake();
|
||||
},
|
||||
[wake],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user