usePlayerUI
Control fullscreen, Picture-in-Picture, and stable player chrome state.
usePlayerUI() exposes stable player chrome state and UI actions.
Use this hook inside Video children, or inside a shared VideoPlayer that contains one Video. The player scope is resolved
automatically.
Signature
const ui = usePlayerUI();It returns:
controlsVisibleisFullscreenisPictureInPictureshowControls()hideControls()toggleFullscreen()togglePictureInPicture()
Example
import {Video, VideoPlayer, usePlayerUI} from "@rixl/media-react";
function CustomDisplayControls() {
const {isFullscreen, isPictureInPicture, toggleFullscreen, togglePictureInPicture} = usePlayerUI();
return (
<div className="flex items-center gap-3">
<button type="button" onClick={() => void toggleFullscreen()}>
{isFullscreen ? "Exit fullscreen" : "Enter fullscreen"}
</button>
<button type="button" onClick={() => void togglePictureInPicture()}>
{isPictureInPicture ? "Exit PiP" : "Enter PiP"}
</button>
</div>
);
}
function CustomPlayer() {
return (
<VideoPlayer>
<CustomDisplayControls />
<Video id="YOUR_VIDEO_ID" theme="hideUI" style={{display: "block", aspectRatio: "16 / 9"}} />
</VideoPlayer>
);
}Notes
- This hook exposes durable chrome state only.
- Internal settings-menu and diagnostics-panel state are not part of this API.
- PiP availability still depends on browser support and media policies.