diff --git a/packages/hlsjs/lib/ui/components/Controls.tsx b/packages/hlsjs/lib/ui/components/Controls.tsx index a804f6f2..289e20c5 100644 --- a/packages/hlsjs/lib/ui/components/Controls.tsx +++ b/packages/hlsjs/lib/ui/components/Controls.tsx @@ -12,6 +12,7 @@ import { useSettings } from "../hooks/useSettings"; import { TimeStat } from "./TimeStat"; import { useTime } from "../hooks/useTime"; import type { HlsState, HlsFacade } from "../../main"; +import { useEffect, useState } from "react"; type ControlsProps = { facade: HlsFacade; @@ -25,9 +26,10 @@ export function Controls({ facade, state }: ControlsProps) { nudge(); }, }); + const [progressSeeking, setProgressSeeking] = useState(false); let controlsVisible = visible; - if (settingsMode) { + if (settingsMode || progressSeeking) { controlsVisible = true; } @@ -48,7 +50,10 @@ export function Controls({ facade, state }: ControlsProps) { { + nudge(); setTargetTime(time); facade.seekTo(time); }} diff --git a/packages/hlsjs/lib/ui/components/Progress.tsx b/packages/hlsjs/lib/ui/components/Progress.tsx index 7bd9b365..8e862865 100644 --- a/packages/hlsjs/lib/ui/components/Progress.tsx +++ b/packages/hlsjs/lib/ui/components/Progress.tsx @@ -1,23 +1,25 @@ -import { - PointerEventHandler, - useRef, - useState, - useEffect, - useCallback, -} from "react"; +import { useRef, useState, useEffect, useCallback } from "react"; import { toHMS } from "../utils"; import cn from "clsx"; import type { HlsState } from "../../main"; +import type { Dispatch, PointerEventHandler } from "react"; type ProgressProps = { time: number; state: HlsState; + seeking: boolean; + setSeeking: Dispatch; onSeeked(value: number): void; }; -export function Progress({ time, state, onSeeked }: ProgressProps) { +export function Progress({ + time, + state, + seeking, + setSeeking, + onSeeked, +}: ProgressProps) { const ref = useRef(null); - const [seeking, setSeeking] = useState(false); const [hover, setHover] = useState(false); const [value, setValue] = useState(0);