{"version":3,"file":"Custom_Video_Player.cP58MeIY.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/I138TOxpM0qwl8Cf6JJG/Wvo5zGIWrkkCz6Ad2Srd/Custom_Video_Player.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useEffect}from\"react\";import{motion,AnimatePresence}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function CustomVideoPlayer(props){const{vimeoId,posterUrl,style}=props;const[isPlaying,setIsPlaying]=useState(true);const[hasError,setHasError]=useState(false);const videoRef=useRef(null);useEffect(()=>{if(!vimeoId){setHasError(true);return;}const video=videoRef.current;if(!video)return;const playPromise=video.play();if(playPromise!==undefined){playPromise.then(()=>setIsPlaying(true)).catch(error=>{console.warn(\"Autoplay prevented:\",error);setIsPlaying(false);});}},[vimeoId]);const togglePlayPause=()=>{const video=videoRef.current;if(!video)return;try{if(video.paused){video.play();}else{video.pause();}}catch(error){console.error(\"Error toggling play state:\",error);}};if(hasError){return /*#__PURE__*/_jsx(\"div\",{style:{...style,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:\"#222\",color:\"#fff\",textAlign:\"center\",padding:20,height:\"100%\",width:\"100%\"},children:/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"p\",{children:\"Unable to load video\"}),/*#__PURE__*/_jsx(\"p\",{style:{fontSize:\"14px\",opacity:.7},children:\"Please check the video URL\"})]})});}return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor:\"#000\",overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:vimeoId,poster:posterUrl,autoPlay:true,loop:false,muted:false,playsInline:true,preload:\"metadata\",onPlay:()=>setIsPlaying(true),onPause:()=>setIsPlaying(false),onError:()=>setHasError(true),style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",objectFit:\"cover\"}}),/*#__PURE__*/_jsx(\"div\",{onClick:togglePlayPause,style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",zIndex:5,cursor:\"pointer\"}}),/*#__PURE__*/_jsx(AnimatePresence,{children:!isPlaying&&/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2},style:{position:\"absolute\",top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\",zIndex:10,background:\"rgba(0, 0, 0, 0.5)\",borderRadius:\"50%\",width:64,height:64,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},onClick:togglePlayPause,children:/*#__PURE__*/_jsx(\"svg\",{width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"white\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M8 5v14l11-7z\"})})})})]});}addPropertyControls(CustomVideoPlayer,{vimeoId:{type:ControlType.String,title:\"Video URL\",defaultValue:\"\",placeholder:\"https://your-zone.b-cdn.net/video.mp4\"},posterUrl:{type:ControlType.Image,title:\"Poster Image\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CustomVideoPlayer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Custom_Video_Player.map"],"mappings":"wPAGG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,UAAQ,YAAU,SAAO,EAAW,CAAC,EAAU,GAAcA,EAAS,EAAI,EAAO,CAAC,EAAS,GAAaA,EAAS,EAAK,EAAQ,EAASC,EAAO,IAAI,EAAE,MAAc,CAAC,GAAG,CAAC,EAAQ,CAAC,EAAY,EAAI,EAAE,MAAO,CAAC,IAAM,EAAM,EAAS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