···11-import { useVideoElement } from "contexts/VideoElementContext";
11+import { usePlayerStore } from "@streamplace/components";
22import { useCallback } from "react";
33-import { isWeb } from "tamagui";
43import { captureVideoFrame } from "utils/videoCapture";
5465/**
···1211 * @returns A function that captures a frame from the video element
1312 */
1413export function useCaptureVideoFrame() {
1515- const videoElement = useVideoElement();
1414+ const ref = usePlayerStore((state) => state.videoRef);
1515+1616+ // if ref is a function return null
1717+ if (typeof ref === "function") {
1818+ console.warn(
1919+ "Video ref is a function (native player), cannot capture frame",
2020+ );
2121+ return null;
2222+ }
2323+2424+ const videoElement = ref?.current;
16251726 const captureFrame = useCallback(
1827 async (maxWidth = 1280, quality = 0.85): Promise<Blob | null> => {
1919- if (!isWeb || !videoElement) {
2828+ if (!videoElement) {
2029 console.warn("Video element not available or not on web platform");
2130 return null;
2231 }