{"version":3,"file":"VideoPlay.CU2DYoc_.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/CtMUZ0lOYJQnLR6MT9Bv/QJTZm89gzj15QauKlr45/VideoPlay.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{Frame,addPropertyControls,ControlType}from\"framer\";import{useInView}from\"framer-motion\";export function AutoPlayVideo(props){const{videoUrl,poster,width,height,borderRadius,autoplay,muted,loop}=props;const videoRef=useRef(null);const inViewRef=useRef(null);const isInView=useInView(inViewRef,{margin:\"0px 0px -20% 0px\",once:false});useEffect(()=>{const video=videoRef.current;if(!video)return;if(isInView){video.play().catch(()=>{});}else{video.pause();}},[isInView]);return /*#__PURE__*/_jsx(Frame,{ref:inViewRef,width:width,height:height,radius:borderRadius,overflow:\"hidden\",background:\"#000\",children:/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoUrl,poster:poster,width:\"100%\",height:\"100%\",style:{objectFit:\"cover\",width:\"100%\",height:\"100%\"},playsInline:true,muted:muted,loop:loop,preload:\"metadata\",autoPlay:false,controls:false})});}AutoPlayVideo.defaultProps={width:\"100%\",height:\"100%\",borderRadius:0,videoUrl:\"https://www.w3schools.com/html/mov_bbb.mp4\",poster:\"\",autoplay:true,muted:true,loop:true};addPropertyControls(AutoPlayVideo,{videoUrl:{type:ControlType.String,title:\"Video URL\"},poster:{type:ControlType.Image,title:\"Poster\"},borderRadius:{type:ControlType.Number,title:\"Radius\",min:0,max:100},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:true},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"AutoPlayVideo\":{\"type\":\"reactComponent\",\"name\":\"AutoPlayVideo\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VideoPlay.map"],"mappings":"wWAA8K,SAAgB,EAAc,E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