import { Box } from "@mui/material"; import { getVideo } from "./helper"; import type { SxProps } from "@mui/material"; import useSWR from "swr"; import LoadingSkeleton from "../LoadingSkeleton"; import { ApologyPage } from "@/components/ViewPublicationPage/ApologyPage"; type VideoIframeProps = { videoUrl: string; containerSX?: SxProps; }; export default function QuizVideo({ videoUrl, containerSX }: VideoIframeProps) { console.log("=== QuizVideo component called ==="); console.log("QuizVideo component called with URL:", videoUrl); console.log("ContainerSX:", containerSX); const { data: videoData, error, isLoading } = useSWR(["video", videoUrl], (params) => getVideo(params[1])); console.log("Video data:", videoData); console.log("Error:", error); console.log("Is loading:", isLoading); console.log("=== End QuizVideo component ==="); return ( {isLoading ? ( ) : !videoData || error ? ( ) : videoData.sourceName === "custom" || videoData.sourceName === "yandex" ? ( console.error("Video error:", e)} onLoadStart={() => console.log("Video load started")} onCanPlay={() => console.log("Video can play")} src={videoData.url} /> ) : ( )} ); }