diff --git a/packages/hlsjs/index.html b/packages/hlsjs/index.html
index 0bc1e4dc..6848fbee 100644
--- a/packages/hlsjs/index.html
+++ b/packages/hlsjs/index.html
@@ -4,7 +4,7 @@
HLSjs wrapper
-
+
(null);
-
- const setSettings = (value: SettingsMode) => {
- setSettings_((v) => (v !== value ? value : null));
- };
-
- return [settings, setSettings] as const;
-}
diff --git a/packages/hlsjs/lib/Controls/index.tsx b/packages/hlsjs/lib/Controls/index.tsx
deleted file mode 100644
index 7e6eec34..00000000
--- a/packages/hlsjs/lib/Controls/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { Controls } from "./components/Controls";
diff --git a/packages/hlsjs/lib/main.ts b/packages/hlsjs/lib/main.ts
index 01349541..a9a29e88 100644
--- a/packages/hlsjs/lib/main.ts
+++ b/packages/hlsjs/lib/main.ts
@@ -4,7 +4,7 @@ import EventEmitter from "eventemitter3";
import type { Spec } from "immutability-helper";
import type { Level, MediaPlaylist } from "hls.js";
-export { Controls as HlsControls } from "./Controls";
+export { Root as HlsUi } from "./ui";
export type HlsInterstitial = {
seekAllowed: boolean;
diff --git a/packages/hlsjs/lib/Controls/components/CheckList.scss b/packages/hlsjs/lib/ui/components/CheckList.scss
similarity index 100%
rename from packages/hlsjs/lib/Controls/components/CheckList.scss
rename to packages/hlsjs/lib/ui/components/CheckList.scss
diff --git a/packages/hlsjs/lib/Controls/components/CheckList.tsx b/packages/hlsjs/lib/ui/components/CheckList.tsx
similarity index 100%
rename from packages/hlsjs/lib/Controls/components/CheckList.tsx
rename to packages/hlsjs/lib/ui/components/CheckList.tsx
diff --git a/packages/hlsjs/lib/Controls/components/Controls.scss b/packages/hlsjs/lib/ui/components/Controls.scss
similarity index 88%
rename from packages/hlsjs/lib/Controls/components/Controls.scss
rename to packages/hlsjs/lib/ui/components/Controls.scss
index 8bcfcb33..539a33bf 100644
--- a/packages/hlsjs/lib/Controls/components/Controls.scss
+++ b/packages/hlsjs/lib/ui/components/Controls.scss
@@ -24,7 +24,7 @@
}
}
-.mix-controls-buttons {
+.mix-controls-bottom {
display: flex;
column-gap: 1em;
height: 4em;
@@ -34,3 +34,7 @@
.mix-controls-gutter {
flex-grow: 1;
}
+
+.mix-controls-progress {
+ display: flex;
+}
diff --git a/packages/hlsjs/lib/Controls/components/Controls.tsx b/packages/hlsjs/lib/ui/components/Controls.tsx
similarity index 59%
rename from packages/hlsjs/lib/Controls/components/Controls.tsx
rename to packages/hlsjs/lib/ui/components/Controls.tsx
index a6baf9be..f27b9f82 100644
--- a/packages/hlsjs/lib/Controls/components/Controls.tsx
+++ b/packages/hlsjs/lib/ui/components/Controls.tsx
@@ -1,4 +1,3 @@
-import { useEffect, useState } from "react";
import cn from "clsx";
import { Progress } from "./Progress";
import PlayIcon from "../icons/play.svg?react";
@@ -7,42 +6,50 @@ import SettingsIcon from "../icons/settings.svg?react";
import SubtitlesIcon from "../icons/subtitles.svg?react";
import { useVisible } from "../hooks/useVisible";
import { Settings } from "./Settings";
-import { useSettings } from "../hooks/useSettings";
import { SqButton } from "./SqButton";
+import { useSettings } from "../hooks/useSettings";
+import { TimeStat } from "./TimeStat";
import type { HlsState, HlsFacade } from "../../main";
type ControlsProps = {
facade: HlsFacade;
+ state: HlsState;
};
-export function Controls({ facade }: ControlsProps) {
- const [state, setState] = useState(facade.state);
- const { visible, elementRef } = useVisible();
- const [settingsMode, setSettingsMode] = useSettings();
+export function Controls({ facade, state }: ControlsProps) {
+ const { visible, elementRef, nudge } = useVisible();
+ const [settingsMode, setSettingsMode] = useSettings({
+ onChange: () => {
+ nudge();
+ },
+ });
- useEffect(() => {
- const update = () => setState(facade.state);
- facade.on("*", update);
- return () => {
- facade.off("*", update);
- };
- }, [facade]);
+ let controlsVisible = visible;
+ if (settingsMode) {
+ controlsVisible = true;
+ }
return (
<>
{showSeekbar(state) ? (
-