···1-import { useVideoElement } from "contexts/VideoElementContext";
2import { useCallback } from "react";
3-import { isWeb } from "tamagui";
4import { captureVideoFrame } from "utils/videoCapture";
56/**
···12 * @returns A function that captures a frame from the video element
13 */
14export function useCaptureVideoFrame() {
15- const videoElement = useVideoElement();
00000000001617 const captureFrame = useCallback(
18 async (maxWidth = 1280, quality = 0.85): Promise<Blob | null> => {
19- if (!isWeb || !videoElement) {
20 console.warn("Video element not available or not on web platform");
21 return null;
22 }
···1+import { usePlayerStore } from "@streamplace/components";
2import { useCallback } from "react";
03import { captureVideoFrame } from "utils/videoCapture";
45/**
···11 * @returns A function that captures a frame from the video element
12 */
13export function useCaptureVideoFrame() {
14+ const ref = usePlayerStore((state) => state.videoRef);
15+16+ // if ref is a function return null
17+ if (typeof ref === "function") {
18+ console.warn(
19+ "Video ref is a function (native player), cannot capture frame",
20+ );
21+ return null;
22+ }
23+24+ const videoElement = ref?.current;
2526 const captureFrame = useCallback(
27 async (maxWidth = 1280, quality = 0.85): Promise<Blob | null> => {
28+ if (!videoElement) {
29 console.warn("Video element not available or not on web platform");
30 return null;
31 }