strata-react 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/UPGRADING.md CHANGED
@@ -11,6 +11,9 @@ time. While the version is 0.x, any release may break.
11
11
 
12
12
  Every PR that changes what an app sees adds a line here (see `CLAUDE.md`, "Changelog").
13
13
 
14
+ ## 2026-11-18
15
+ - `MediaPlayer` hides the custom controls after three idle seconds during full-screen playback. Moving the mouse or using the keyboard reveals them.
16
+
14
17
  ## 2026-11-15
15
18
 
16
19
  - `MediaPlayer` (video, Strata's controls) now has a Full screen button after the volume and an `f` key (where the browser has the Fullscreen API); pass `fullscreen={false}` to remove them. The player is wrapped in `FullscreenFrame`, so a test that counts buttons or a baseline of a video player changes.
package/dist/index.js CHANGED
@@ -3812,6 +3812,19 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
3812
3812
  const [fullApi, setFullApi] = React.useState(false);
3813
3813
  React.useEffect(() => setFullApi(canFullscreen()), []);
3814
3814
  const canFull = fullscreen && fullApi && kind === "video" && !native;
3815
+ const autoHideControls = full && canFull && media.playing;
3816
+ const [controlsIdle, setControlsIdle] = React.useState(false);
3817
+ const idleTimer = React.useRef(void 0);
3818
+ const wakeControls = React.useCallback(() => {
3819
+ clearTimeout(idleTimer.current);
3820
+ setControlsIdle(false);
3821
+ if (autoHideControls) idleTimer.current = setTimeout(() => setControlsIdle(true), 3e3);
3822
+ }, [autoHideControls]);
3823
+ React.useEffect(() => {
3824
+ wakeControls();
3825
+ return () => clearTimeout(idleTimer.current);
3826
+ }, [wakeControls]);
3827
+ const hideControls = autoHideControls && controlsIdle;
3815
3828
  const stage = React.useRef(null);
3816
3829
  const latest = React.useRef(media);
3817
3830
  latest.current = media;
@@ -3888,7 +3901,14 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
3888
3901
  shortcuts,
3889
3902
  native
3890
3903
  ]);
3891
- useHotkeys(keys, { enabled: shortcuts && !native && (page.count <= 1 || page.active === id) });
3904
+ const activeKeys = autoHideControls ? keys.map((shortcut) => ({
3905
+ ...shortcut,
3906
+ run: () => {
3907
+ wakeControls();
3908
+ shortcut.run();
3909
+ }
3910
+ })) : keys;
3911
+ useHotkeys(activeKeys, { enabled: shortcuts && !native && (page.count <= 1 || page.active === id) });
3892
3912
  React.useEffect(() => {
3893
3913
  if (!session || typeof navigator === "undefined" || !("mediaSession" in navigator) || typeof MediaMetadata === "undefined") return;
3894
3914
  const s = navigator.mediaSession;
@@ -3980,6 +4000,8 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
3980
4000
  role: "group",
3981
4001
  "aria-label": label,
3982
4002
  onFocusCapture: () => keyPlayers.use(id),
4003
+ onMouseMoveCapture: autoHideControls ? wakeControls : void 0,
4004
+ onKeyDownCapture: autoHideControls ? wakeControls : void 0,
3983
4005
  onPointerDownCapture: () => keyPlayers.use(id),
3984
4006
  className: cn("grid w-full gap-2", full && "flex h-full min-h-0 flex-col"),
3985
4007
  children: [
@@ -4038,7 +4060,7 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
4038
4060
  children: media.playing ? `Playing ${format.runningTime(bound.start)} to ${format.runningTime(bound.end)}` : ""
4039
4061
  }) })] }),
4040
4062
  !native && /* @__PURE__ */ jsxs("div", {
4041
- className: "grid gap-2",
4063
+ className: cn("grid gap-2", hideControls && "pointer-events-none opacity-0 has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:opacity-100"),
4042
4064
  children: [/* @__PURE__ */ jsxs("div", {
4043
4065
  className: "flex min-w-0 items-center gap-3",
4044
4066
  children: [/* @__PURE__ */ jsx(SeekBar, {