mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-12 06:05:22 +03:00
refresh
This commit is contained in:
parent
24017d203b
commit
016ab9ade9
@ -43,7 +43,6 @@ import { Skeleton } from "@/components/ui/skeleton";
|
|||||||
import { FaVideo } from "react-icons/fa";
|
import { FaVideo } from "react-icons/fa";
|
||||||
import { VideoResolutionType } from "@/types/live";
|
import { VideoResolutionType } from "@/types/live";
|
||||||
import { ASPECT_VERTICAL_LAYOUT, ASPECT_WIDE_LAYOUT } from "@/types/record";
|
import { ASPECT_VERTICAL_LAYOUT, ASPECT_WIDE_LAYOUT } from "@/types/record";
|
||||||
import { cn } from "@/lib/utils";
|
|
||||||
|
|
||||||
const SEGMENT_DURATION = 30;
|
const SEGMENT_DURATION = 30;
|
||||||
|
|
||||||
@ -77,7 +76,6 @@ 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);
|
||||||
@ -210,36 +208,7 @@ export function RecordingView({
|
|||||||
[currentTime],
|
[currentTime],
|
||||||
);
|
);
|
||||||
|
|
||||||
// fullscreen
|
// motion timeline data
|
||||||
|
|
||||||
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) => {
|
||||||
@ -403,40 +372,19 @@ 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={cn(
|
|
||||||
"h-full flex justify-center overflow-hidden",
|
|
||||||
isDesktop ? "" : "flex-col landscape:flex-row gap-2",
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
<div
|
<div className={`${isDesktop ? "w-[80%]" : ""} flex flex-1 flex-wrap`}>
|
||||||
className={cn("flex flex-1 flex-wrap", isDesktop ? "w-[80%]" : "")}
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
className={`size-full flex items-center ${mainCameraAspect == "tall" ? "flex-row justify-evenly" : "flex-col justify-center gap-2"}`}
|
className={`size-full flex items-center ${mainCameraAspect == "tall" ? "flex-row justify-evenly" : "flex-col justify-center gap-2"}`}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
key={mainCamera}
|
key={mainCamera}
|
||||||
className={cn(
|
className={`relative ${
|
||||||
"relative",
|
|
||||||
isDesktop
|
isDesktop
|
||||||
? cn(
|
? `${mainCameraAspect == "tall" ? "h-[50%] md:h-[60%] lg:h-[75%] xl:h-[90%]" : mainCameraAspect == "wide" ? "w-full" : "w-[78%]"} px-4 flex justify-center`
|
||||||
"px-4 flex justify-center",
|
: `portrait:w-full pt-2 ${mainCameraAspect == "wide" ? "landscape:w-full aspect-wide" : "landscape:h-[94%] aspect-video"}`
|
||||||
mainCameraAspect == "tall"
|
}`}
|
||||||
? "h-[50%] md:h-[60%] lg:h-[75%] xl:h-[90%]"
|
|
||||||
: mainCameraAspect == "wide"
|
|
||||||
? "w-full"
|
|
||||||
: fullscreen
|
|
||||||
? "w-[100%]"
|
|
||||||
: "w-[78%]",
|
|
||||||
)
|
|
||||||
: cn(
|
|
||||||
"portrait:w-full pt-2",
|
|
||||||
mainCameraAspect == "wide"
|
|
||||||
? "landscape:w-full aspect-wide"
|
|
||||||
: "landscape:h-[94%] aspect-video",
|
|
||||||
),
|
|
||||||
)}
|
|
||||||
style={{
|
style={{
|
||||||
aspectRatio: isDesktop
|
aspectRatio: isDesktop
|
||||||
? mainCameraAspect == "tall"
|
? mainCameraAspect == "tall"
|
||||||
@ -452,7 +400,6 @@ 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);
|
||||||
@ -466,17 +413,11 @@ export function RecordingView({
|
|||||||
}}
|
}}
|
||||||
isScrubbing={scrubbing || exportMode == "timeline"}
|
isScrubbing={scrubbing || exportMode == "timeline"}
|
||||||
setFullResolution={setFullResolution}
|
setFullResolution={setFullResolution}
|
||||||
setFullscreen={onToggleFullscreen}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{isDesktop && (
|
{isDesktop && (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={`flex gap-2 ${mainCameraAspect == "tall" ? "h-full w-[12%] flex-col justify-center overflow-y-auto" : "w-full h-[14%] justify-center items-center overflow-x-auto"} `}
|
||||||
"flex gap-2",
|
|
||||||
mainCameraAspect == "tall"
|
|
||||||
? "h-full w-[12%] flex-col justify-center overflow-y-auto"
|
|
||||||
: `justify-center items-center overflow-x-auto ${fullscreen ? "h-[12%]" : "h-[14%]"}`,
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{allCameras.map((cam) => {
|
{allCameras.map((cam) => {
|
||||||
if (cam == mainCamera) {
|
if (cam == mainCamera) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user