{"version":3,"file":"ResponsiveVideo.BShochvb.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/z575PYo4r9qReooMGW25/nqkX12zCqH3fSwHT4vSD/ResponsiveVideo.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useRef,useEffect,useState}from\"react\";export default function ResponsiveVideo(props){const{videoFile,borderRadius,borderWidth,borderColor,backgroundColor,playOnScroll,threshold,startTime}=props;const containerRef=useRef(null);const videoRef=useRef(null);const[isVisible,setIsVisible]=useState(false);useEffect(()=>{if(!playOnScroll)return;const observer=new IntersectionObserver(([entry])=>{setIsVisible(entry.isIntersecting);},{threshold:threshold});if(containerRef.current){observer.observe(containerRef.current);}return()=>observer.disconnect();},[playOnScroll,threshold]);useEffect(()=>{if(!videoRef.current)return;if(!playOnScroll){videoRef.current.play().catch(()=>{});return;}if(isVisible){videoRef.current.play().catch(()=>{});}else{videoRef.current.pause();}},[isVisible,playOnScroll]);useEffect(()=>{if(videoRef.current&&startTime>0){videoRef.current.currentTime=startTime;}},[startTime]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",borderRadius:borderRadius,border:`${borderWidth}px solid ${borderColor}`,backgroundColor:backgroundColor,overflow:\"hidden\",lineHeight:0},children:videoFile&&/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoFile,autoPlay:!playOnScroll,loop:true,muted:true,playsInline:true,style:{display:\"block\",width:\"100%\",height:\"auto\"}})});}ResponsiveVideo.defaultProps={videoFile:\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",borderRadius:16,borderWidth:1,borderColor:\"rgb(230, 230, 235)\",backgroundColor:\"rgb(250, 249, 246)\",playOnScroll:true,threshold:.3,startTime:.5};addPropertyControls(ResponsiveVideo,{videoFile:{type:ControlType.File,title:\"Video File\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},playOnScroll:{type:ControlType.Boolean,title:\"Play on Scroll\",defaultValue:true,description:\"Only play when the video is visible in the viewport\"},threshold:{type:ControlType.Number,title:\"Visibility %\",defaultValue:.3,min:.1,max:1,step:.1,hidden:props=>!props.playOnScroll},startTime:{type:ControlType.Number,title:\"Start Time (s)\",defaultValue:.5,min:0,max:60,step:.5},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:16,min:0,max:50,step:1},borderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:1,min:0,max:10,step:1},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"rgb(230, 230, 235)\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"rgb(250, 249, 246)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ResponsiveVideo\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ResponsiveVideo.map"],"mappings":"+KAA4I,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,YAAU,eAAa,cAAY,cAAY,kBAAgB,eAAa,YAAU,aAAW,EAAY,EAAaA,EAAO,KAAK,CAAO,EAASA,EAAO,KAAK,CAAM,CAAC,EAAU,GAAcC,EAAS,GAAM,CAAwlB,OAAvlB,MAAc,CAAC,GAAG,CAAC,EAAa,OAAO,IAAM,EAAS,IAAI,sBAAsB,CAAC,KAAS,CAAC,EAAa,EAAM,eAAe,EAAG,CAAW,YAAU,CAAC,CAAkE,OAA9D,EAAa,SAAS,EAAS,QAAQ,EAAa,QAAQ,KAAY,EAAS,YAAY,EAAG,CAAC,EAAa,EAAU,CAAC,CAAC,MAAc,CAAK,KAAS,QAAe,IAAG,CAAC,EAAa,CAAC,EAAS,QAAQ,MAAM,CAAC,UAAU,GAAG,CAAC,OAAW,EAAW,EAAS,QAAQ,MAAM,CAAC,UAAU,GAAG,CAAO,EAAS,QAAQ,OAAO,GAAI,CAAC,EAAU,EAAa,C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