fix(player): re-enable controls auto-hide, keep open while settings popover is open

Tapping to reveal the controls showed them permanently — they never auto-hid
after the inactivity timeout (CONTROLS_CONSTANTS.TIMEOUT). Root cause:
useControlsTimeout was called with a hardcoded disabled: true (introduced in
the KSPlayer work in #1266), so the auto-hide timer was never armed.

Simply removing that override re-introduced a regression on iOS: the timer
fired while the settings popover was open, dismissing it mid-interaction
(subtitle / audio / speed selection), because on iOS the popover lives inside
the controls and closes when they fade out.

Surface the popover's open state through a small ControlsContext (rather than
prop drilling through HeaderControls) and feed it to useControlsTimeout's
disabled flag, so auto-hide pauses while the menu is open and re-arms once it
closes. Android's menu is a separate global bottom-sheet modal, unaffected.

Fixes #1243. Regression from #1266. Depends on #1621.
This commit is contained in:
Gauvino
2026-06-16 11:27:14 +02:00
parent fef1e7f122
commit ac0018092a
3 changed files with 154 additions and 115 deletions

View File

@@ -7,6 +7,7 @@ import { PLAYBACK_SPEEDS } from "@/components/PlaybackSpeedSelector";
import useRouter from "@/hooks/useAppRouter";
import { useOfflineMode } from "@/providers/OfflineModeProvider";
import { useSettings } from "@/utils/atoms/settings";
import { useControlsContext } from "../contexts/ControlsContext";
import { usePlayerContext } from "../contexts/PlayerContext";
import { useVideoContext } from "../contexts/VideoContext";
import { PlaybackSpeedScope } from "../utils/playback-speed-settings";
@@ -30,6 +31,8 @@ const DropdownView = ({
}: DropdownViewProps) => {
const { subtitleTracks, audioTracks } = useVideoContext();
const { item, mediaSource } = usePlayerContext();
// Report popover open/close so Controls can pause auto-hide while it's open.
const { setSettingsMenuOpen } = useControlsContext();
const { settings, updateSettings } = useSettings();
const router = useRouter();
const isOffline = useOfflineMode();
@@ -223,6 +226,7 @@ const DropdownView = ({
groups={optionGroups}
trigger={trigger}
expoUIConfig={{}}
onOpenChange={setSettingsMenuOpen}
bottomSheetConfig={{
enablePanDownToClose: true,
}}