{"version":3,"file":"VideoPlayerScrollTrigger.CNeavPSK.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/bLPibnXje5XydGFB6Mok/FJBpVqo2LpcKFJ1pnH8b/VideoPlayerScrollTrigger.js"],"sourcesContent":["// Video player with scroll trigger functionality\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useInView}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */function VideoPlayerScrollTrigger(props){const{videoFile=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",autoplay,muted,loop,controls,playOnScroll,pauseOnScrollOut,backgroundColor,borderRadius,objectFit}=props;const videoRef=useRef(null);const[isPlaying,setIsPlaying]=useState(false);const isInView=useInView(videoRef,{margin:\"0px 0px -50px 0px\"});const isStatic=useIsStaticRenderer();// Handle scroll-based play/pause\nuseEffect(()=>{if(isStatic||!videoRef.current)return;const video=videoRef.current;if(playOnScroll&&isInView){video.play().then(()=>{startTransition(()=>setIsPlaying(true));}).catch(()=>{// Video play failed, ignore\n});}else if(pauseOnScrollOut&&!isInView){video.pause();startTransition(()=>setIsPlaying(false));}},[isInView,playOnScroll,pauseOnScrollOut,isStatic]);// Handle autoplay\nuseEffect(()=>{if(isStatic||!videoRef.current||!autoplay)return;const video=videoRef.current;video.play().then(()=>{startTransition(()=>setIsPlaying(true));}).catch(()=>{// Video play failed, ignore\n});},[autoplay,isStatic]);const handlePlay=()=>{startTransition(()=>setIsPlaying(true));};const handlePause=()=>{startTransition(()=>setIsPlaying(false));};if(isStatic){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",backgroundColor,borderRadius,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:\"#666\",fontSize:\"14px\",fontFamily:\"system-ui, sans-serif\"},children:\"Video Preview\"});}return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",backgroundColor,borderRadius,overflow:\"hidden\",position:\"relative\"},children:/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoFile,muted:muted,loop:loop,controls:controls,playsInline:true,onPlay:handlePlay,onPause:handlePause,style:{width:\"100%\",height:\"100%\",objectFit,display:\"block\"},\"aria-label\":\"Scroll-triggered video\"})});}export default VideoPlayerScrollTrigger;addPropertyControls(VideoPlayerScrollTrigger,{videoFile:{type:ControlType.File,title:\"Video File\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},controls:{type:ControlType.Boolean,title:\"Show Controls\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},playOnScroll:{type:ControlType.Boolean,title:\"Play on Scroll\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},pauseOnScrollOut:{type:ControlType.Boolean,title:\"Pause on Scroll Out\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},objectFit:{type:ControlType.Enum,title:\"Object Fit\",options:[\"cover\",\"contain\",\"fill\",\"none\",\"scale-down\"],optionTitles:[\"Cover\",\"Contain\",\"Fill\",\"None\",\"Scale Down\"],defaultValue:\"cover\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:0,min:0,max:50,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoPlayerScrollTrigger\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",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