{"version":3,"file":"HeroVideoPlayer.DmImCync.mjs","names":["useRef","useState","useCallback","useMemo","_Fragment"],"sources":["https:/framerusercontent.com/modules/o4iaICsotjFTJ9bMn3n3/dpknxoS0gWmV0Qsx3UL8/HeroVideoPlayer.js"],"sourcesContent":["// Video Hero Player for Framer\n// Looping, muted preview with play button; on play, starts over with sound\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useRef,useState,startTransition,useCallback,useMemo}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Video Hero Player\n * Shows a looping, muted preview video as a hero background, overlays a play button. \n * On play, restarts video with sound and controls enabled, fitting hero design as background.\n *\n * @framerIntrinsicWidth 1280\n * @framerIntrinsicHeight 720\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function HeroVideoPlayer(props){const{// Switch to only a single videoUrl/posterUrl at a time\nvideoUrl=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",videoFile=\"\",posterUrl=\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",showPoster=false,buttonColor,buttonIconColor,backgroundColor,borderRadius,style}=props;const videoRef=useRef(null);const[isPlaying,setIsPlaying]=useState(false);// Add missing state for video interactions\nconst[isVideoHovered,setIsVideoHovered]=useState(false);const[showControls,setShowControls]=useState(false);const[isPaused,setIsPaused]=useState(false);const[isMuted,setIsMuted]=useState(true);// Add missing state for showPoster\nconst[showPosterState,setShowPosterState]=useState(showPoster);const handlePlay=useCallback(()=>{if(!videoRef.current)return;// Restart from beginning\nstartTransition(()=>setIsPlaying(true));setTimeout(()=>{if(!videoRef.current)return;videoRef.current.currentTime=0;videoRef.current.muted=false;videoRef.current.loop=false;videoRef.current.volume=1// ensure volume is up\n;// Fix: Use play() with user gesture for mobile compatibility\nconst playPromise=videoRef.current.play();if(playPromise&&typeof playPromise.then===\"function\"){playPromise.catch(()=>{});}videoRef.current.focus()// Ensure focus immediately after play\n;},0);},[]);// Exit to go back to looping, muted video\nconst handleExit=useCallback(()=>{if(!videoRef.current)return;videoRef.current.pause();videoRef.current.currentTime=0// Reset to beginning\n;videoRef.current.muted=true;videoRef.current.loop=true;startTransition(()=>setIsPlaying(false));},[]);// Always loop when not playing; when playing, play once unless looped by user\nconst videoProps=useMemo(()=>{return isPlaying?{muted:false,loop:false,controls:true,autoPlay:true}:{muted:true,loop:true,controls:false,autoPlay:true};},[isPlaying]);const videoSrc=videoFile||videoUrl;// Hide controls on thumbnail rendering\nif(RenderTarget.current()===RenderTarget.thumbnail){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",borderRadius,background:backgroundColor}});}// If showPoster is true and not playing, show the poster only until play is hit\nreturn /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius,background:backgroundColor,...style},children:[showPosterState&&!isPlaying?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"img\",{src:posterUrl,alt:\"Video poster\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",borderRadius,display:\"block\"}}),/*#__PURE__*/_jsx(\"button\",{\"aria-label\":\"Play Video\",style:{position:\"absolute\",top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\",zIndex:10,width:80,height:80,borderRadius:\"50%\",boxShadow:\"0 2px 16px rgba(0,0,0,0.16)\",border:\"none\",background:buttonColor,opacity:.7,backdropFilter:\"blur(10px)\",WebkitBackdropFilter:\"blur(10px)\",cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",transition:\"opacity 0.2s\"},onClick:e=>{startTransition(()=>{setIsPlaying(true);setShowPosterState(false);});handlePlay();// Focus the video element after play to trigger play reliably\nsetTimeout(()=>{if(videoRef.current)videoRef.current.focus();},0);},onMouseEnter:e=>e.currentTarget.style.opacity=\"1\",onMouseLeave:e=>e.currentTarget.style.opacity=\"0.7\",children:/*#__PURE__*/_jsxs(\"svg\",{width:\"42\",height:\"42\",viewBox:\"0 0 42 42\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",\"aria-hidden\":\"true\",children:[/*#__PURE__*/_jsx(\"circle\",{cx:\"21\",cy:\"21\",r:\"20\",stroke:buttonIconColor,strokeWidth:\"2\",fill:\"none\"}),/*#__PURE__*/_jsx(\"polygon\",{points:\"16,13 32,21 16,29\",fill:buttonIconColor})]})})]}):/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoSrc,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\",borderRadius},...videoProps,poster:showPosterState?posterUrl:undefined,tabIndex:-1,playsInline:true,onMouseEnter:()=>setIsVideoHovered(true),onMouseLeave:()=>setIsVideoHovered(false),onPlay:()=>{setShowControls(true);setIsPaused(false);if(isPlaying&&videoRef.current)videoRef.current.muted=false;},onPause:()=>{setShowControls(false);setIsPaused(true);},onVolumeChange:()=>{const newMuted=videoRef.current?videoRef.current.muted:true;setIsMuted(newMuted);},onClick:()=>{if(!isPlaying){handlePlay();}}}),isPlaying&&/*#__PURE__*/_jsx(\"button\",{\"aria-label\":\"Exit Video\",style:{position:\"absolute\",top:24,right:24,zIndex:20,width:40,height:40,borderRadius:\"50%\",background:\"rgba(10,10,10,0.4)\",border:\"none\",cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},onClick:handleExit,children:/*#__PURE__*/_jsxs(\"svg\",{width:\"22\",height:\"22\",viewBox:\"0 0 22 22\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",\"aria-hidden\":\"true\",children:[/*#__PURE__*/_jsx(\"line\",{x1:\"6\",y1:\"6\",x2:\"16\",y2:\"16\",stroke:\"#fff\",strokeWidth:\"2\",strokeLinecap:\"round\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"16\",y1:\"6\",x2:\"6\",y2:\"16\",stroke:\"#fff\",strokeWidth:\"2\",strokeLinecap:\"round\"})]})})]});}addPropertyControls(HeroVideoPlayer,{videoUrl:{type:ControlType.String,title:\"Video Source\",defaultValue:\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",placeholder:\"Paste video URL or upload file\",displayTextArea:false},videoFile:{type:ControlType.File,title:\"Upload Video\",allowedFileTypes:[\"mp4\",\"webm\"]},posterUrl:{type:ControlType.File,title:\"Poster Image\",allowedFileTypes:[\"jpg\",\"jpeg\",\"png\",\"gif\",\"webp\",\"svg\"]},showPoster:{type:ControlType.Boolean,title:\"Show Poster\",defaultValue:false,enabledTitle:\"Poster\",disabledTitle:\"Loop Video\"},buttonColor:{type:ControlType.Color,title:\"Button BG\",defaultValue:\"#FFFFFF\"},buttonIconColor:{type:ControlType.Color,title:\"Button Icon\",defaultValue:\"#111111\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:24,min:0,max:128}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HeroVideoPlayer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"1280\",\"framerIntrinsicHeight\":\"720\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HeroVideoPlayer.map"],"mappings":"2NAYG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CACvD,WAAS,uEAAuE,YAAU,GAAG,YAAU,sEAAsE,aAAW,GAAM,cAAY,kBAAgB,kBAAgB,eAAa,SAAO,EAAY,EAASA,EAAO,IAAI,EAAO,CAAC,EAAU,GAAcC,EAAS,EAAK,EACvU,CAAC,EAAe,GAAmBA,EAAS,EAAK,EAAO,CAAC,EAAa,GAAiBA,EAAS,EAAK,EAAO,CAAC,EAAS,GAAaA,EAAS,E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