/** * Activity / auto-hide concern for the desktop UI plugin. * * Owns the three-state machine: bump → timer → maybe-hide → emit activity event. * All functions take the mutable state bag as the first parameter so they are * pure of `this`, matching the free-function pattern used by topBar.ts and * menus.ts. * * Integration: `DesktopUiPlugin` stores an `ActivityState` instance, passes it * to every call here, and exposes `bumpActivity()` / `maybeHide()` / * `dismissOverlay()` as thin wrappers. */ import type { IVideoPlayer, VideoPlaylistItem } from '../../../index.js'; export interface ActivityState { activityActive: boolean; inactivityToken: number | null; menuOpen: boolean; isScrubbing: boolean; isControlsHovered: boolean; /** * Number of external holders pinning the chrome visible (an outside plugin * with an open overlay of its own — a device picker, say). A count, not a * flag, so independent holders compose: the chrome stays until the last one * releases. `menuOpen` covers this plugin's own menus; this covers everyone * else's. */ chromeHolds: number; } /** * Emit `activity` only when the active state actually flips. * * Desync guard: when showing (`active=true`) the flag may agree but the * container class may have been stripped by a direct `player.emit('activity', * {active:false})` call (bypassing this function). In that case force-emit so * the binary rule re-adds `.active`. The guard is kept for `active=false` so * `maybeHide()` calls while already hidden don't fire noisy events. */ export declare function setActivity(state: ActivityState, player: IVideoPlayer, active: boolean): void; /** * Show controls immediately and (re-)arm the inactivity countdown. * `scheduleHide` must call `maybeHide` after `inactivityMs`. */ export declare function bumpActivity(state: ActivityState, player: IVideoPlayer, inactivityMs: number, scheduleHide: (ms: number) => number): void; /** * Hide controls if playback is active and nothing is blocking the hide. * No-op when paused, menu is open, or controls are hovered. */ export declare function maybeHide(state: ActivityState, player: IVideoPlayer): void; /** * Deliberate paused-state dismiss; bypasses `maybeHide`'s playing-only guard. * Skips when a menu is open or a scrub is releasing. */ export declare function dismissOverlay(state: ActivityState, player: IVideoPlayer): void;