- Implement CameraFeed context and provider with reducer for state management

- able to switch footage on tab clicks
This commit is contained in:
2025-11-27 10:43:56 +00:00
parent 6accac02de
commit 1ada8d0966
9 changed files with 101 additions and 10 deletions

View File

@@ -1,9 +1,12 @@
import { useEffect, useRef } from "react";
import { useGetVideoFeed } from "./useGetVideoFeed";
import { useCameraFeedContext } from "../../../app/context/CameraFeedContext";
export const useCreateVideoSnapshot = () => {
const { state } = useCameraFeedContext();
const cameraFeedID = state?.cameraFeedID;
const latestBitmapRef = useRef<ImageBitmap | null>(null);
const { videoQuery } = useGetVideoFeed();
const { videoQuery } = useGetVideoFeed(cameraFeedID);
const snapShot = videoQuery?.data;
const isloading = videoQuery.isPending;