mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-12 14:15:22 +03:00
Implement basic fullscreen
This commit is contained in:
parent
016ab9ade9
commit
9c151cc33a
@ -76,6 +76,7 @@ export function RecordingView({
|
|||||||
|
|
||||||
const [mainCamera, setMainCamera] = useState(startCamera);
|
const [mainCamera, setMainCamera] = useState(startCamera);
|
||||||
const mainControllerRef = useRef<DynamicVideoController | null>(null);
|
const mainControllerRef = useRef<DynamicVideoController | null>(null);
|
||||||
|
const mainLayoutRef = useRef<HTMLDivElement | null>(null);
|
||||||
const previewRefs = useRef<{ [camera: string]: PreviewController }>({});
|
const previewRefs = useRef<{ [camera: string]: PreviewController }>({});
|
||||||
|
|
||||||
const [playbackStart, setPlaybackStart] = useState(startTime);
|
const [playbackStart, setPlaybackStart] = useState(startTime);
|
||||||
@ -208,7 +209,36 @@ export function RecordingView({
|
|||||||
[currentTime],
|
[currentTime],
|
||||||
);
|
);
|
||||||
|
|
||||||
// motion timeline data
|
// fullscreen
|
||||||
|
|
||||||
|
const [fullscreen, setFullscreen] = useState(false);
|
||||||
|
|
||||||
|
const onToggleFullscreen = useCallback(
|
||||||
|
(full: boolean) => {
|
||||||
|
if (full) {
|
||||||
|
mainLayoutRef.current?.requestFullscreen();
|
||||||
|
} else {
|
||||||
|
document.exitFullscreen();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[mainLayoutRef],
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (mainLayoutRef.current == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const fsListener = () => {
|
||||||
|
setFullscreen(document.fullscreenElement != null);
|
||||||
|
};
|
||||||
|
document.addEventListener("fullscreenchange", fsListener);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener("fullscreenchange", fsListener);
|
||||||
|
};
|
||||||
|
}, [mainLayoutRef]);
|
||||||
|
|
||||||
|
// layout
|
||||||
|
|
||||||
const getCameraAspect = useCallback(
|
const getCameraAspect = useCallback(
|
||||||
(cam: string) => {
|
(cam: string) => {
|
||||||
@ -372,6 +402,7 @@ export function RecordingView({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
ref={mainLayoutRef}
|
||||||
className={`h-full flex justify-center overflow-hidden ${isDesktop ? "" : "flex-col landscape:flex-row gap-2"}`}
|
className={`h-full flex justify-center overflow-hidden ${isDesktop ? "" : "flex-col landscape:flex-row gap-2"}`}
|
||||||
>
|
>
|
||||||
<div className={`${isDesktop ? "w-[80%]" : ""} flex flex-1 flex-wrap`}>
|
<div className={`${isDesktop ? "w-[80%]" : ""} flex flex-1 flex-wrap`}>
|
||||||
@ -400,6 +431,7 @@ export function RecordingView({
|
|||||||
cameraPreviews={allPreviews ?? []}
|
cameraPreviews={allPreviews ?? []}
|
||||||
startTimestamp={playbackStart}
|
startTimestamp={playbackStart}
|
||||||
hotKeys={exportMode != "select"}
|
hotKeys={exportMode != "select"}
|
||||||
|
fullscreen={fullscreen}
|
||||||
onTimestampUpdate={(timestamp) => {
|
onTimestampUpdate={(timestamp) => {
|
||||||
setPlayerTime(timestamp);
|
setPlayerTime(timestamp);
|
||||||
setCurrentTime(timestamp);
|
setCurrentTime(timestamp);
|
||||||
@ -413,6 +445,7 @@ export function RecordingView({
|
|||||||
}}
|
}}
|
||||||
isScrubbing={scrubbing || exportMode == "timeline"}
|
isScrubbing={scrubbing || exportMode == "timeline"}
|
||||||
setFullResolution={setFullResolution}
|
setFullResolution={setFullResolution}
|
||||||
|
setFullscreen={onToggleFullscreen}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{isDesktop && (
|
{isDesktop && (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user