{"version":3,"file":"VideoPlayer.Da2zD4rl.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/tF0F6JAy9IcvvmsdImzW/L7lJvU2R7KrGEm2pCH0r/VideoPlayer.js"],"sourcesContent":["// Video component with customizable dark gradient overlay\n// Supports both URL input and file upload\n// Includes intensity control for gradient effect\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState}from\"react\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function VideoPlayer(props){const{videoSource=\"url\",videoUrl=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",videoFile=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",gradientIntensity=50,gradientDirection=\"bottom\",gradientHeight=50,autoplay=true,loop=true,muted=true,controls=false,objectFit=\"cover\",saturation=100,playbackControl=\"play\",resolution=\"auto\",videoUrlSmall,videoUrlMedium,videoUrlLarge,videoUrlFull,style}=props;const videoRef=useRef(null);const[posterUrl,setPosterUrl]=useState(\"\");const[currentQuality,setCurrentQuality]=useState(\"medium\");const[networkSpeed,setNetworkSpeed]=useState(5)// Mbps\n;// Detect network speed\nuseEffect(()=>{if(typeof window===\"undefined\")return;const connection=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(connection){const updateNetworkInfo=()=>{const downlink=connection.downlink||5// Mbps\n;setNetworkSpeed(downlink);};updateNetworkInfo();connection.addEventListener(\"change\",updateNetworkInfo);return()=>{connection.removeEventListener(\"change\",updateNetworkInfo);};}},[]);// Determine best quality based on resolution setting and network speed\nconst getVideoSource=()=>{const baseSrc=videoSource===\"url\"?videoUrl:videoFile;if(resolution===\"auto\"||resolution===\"autoLossless\"){// Auto-select based on network speed\nlet selectedQuality=\"medium\";if(networkSpeed>=10){selectedQuality=\"full\";}else if(networkSpeed>=5){selectedQuality=\"large\";}else if(networkSpeed>=2){selectedQuality=\"medium\";}else{selectedQuality=\"small\";}// For autoLossless, prefer higher quality\nif(resolution===\"autoLossless\"&&networkSpeed>=3){selectedQuality=networkSpeed>=8?\"full\":\"large\";}// Return the appropriate quality URL if available\nif(selectedQuality===\"small\"&&videoUrlSmall)return videoUrlSmall;if(selectedQuality===\"medium\"&&videoUrlMedium)return videoUrlMedium;if(selectedQuality===\"large\"&&videoUrlLarge)return videoUrlLarge;if(selectedQuality===\"full\"&&videoUrlFull)return videoUrlFull;return baseSrc;}// Manual quality selection\nif(resolution===\"small\"&&videoUrlSmall)return videoUrlSmall;if(resolution===\"medium\"&&videoUrlMedium)return videoUrlMedium;if(resolution===\"large\"&&videoUrlLarge)return videoUrlLarge;if(resolution===\"full\"&&videoUrlFull)return videoUrlFull;return baseSrc;};const videoSrc=getVideoSource();// Update current quality when network speed or resolution changes\nuseEffect(()=>{if(resolution===\"auto\"||resolution===\"autoLossless\"){let selectedQuality=\"medium\";if(networkSpeed>=10){selectedQuality=\"full\";}else if(networkSpeed>=5){selectedQuality=\"large\";}else if(networkSpeed>=2){selectedQuality=\"medium\";}else{selectedQuality=\"small\";}if(resolution===\"autoLossless\"&&networkSpeed>=3){selectedQuality=networkSpeed>=8?\"full\":\"large\";}setCurrentQuality(selectedQuality);}else{setCurrentQuality(resolution);}},[networkSpeed,resolution]);useEffect(()=>{const video=videoRef.current;if(!video)return;const generatePoster=()=>{const canvas=document.createElement(\"canvas\");canvas.width=video.videoWidth;canvas.height=video.videoHeight;const ctx=canvas.getContext(\"2d\");if(ctx){ctx.drawImage(video,0,0,canvas.width,canvas.height);setPosterUrl(canvas.toDataURL());}};const handleLoadedData=()=>{video.currentTime=1// Set to 1 second\n;};const handleSeeked=()=>{generatePoster();};video.addEventListener(\"loadeddata\",handleLoadedData);video.addEventListener(\"seeked\",handleSeeked);return()=>{video.removeEventListener(\"loadeddata\",handleLoadedData);video.removeEventListener(\"seeked\",handleSeeked);};},[videoSrc]);useEffect(()=>{const video=videoRef.current;if(!video)return;if(playbackControl===\"play\"){video.play().catch(()=>{// Handle play error silently\n});}else{video.pause();}},[playbackControl]);const getGradientStyle=()=>{const opacity=gradientIntensity/100;const gradients={top:`linear-gradient(to bottom, rgba(0, 0, 0, ${opacity}), transparent)`,bottom:`linear-gradient(to top, rgba(0, 0, 0, ${opacity}), transparent)`,left:`linear-gradient(to right, rgba(0, 0, 0, ${opacity}), transparent)`,right:`linear-gradient(to left, rgba(0, 0, 0, ${opacity}), transparent)`};return gradients[gradientDirection];};const getGradientPosition=()=>{const heightPercent=`${gradientHeight}%`;switch(gradientDirection){case\"top\":return{top:0,left:0,width:\"100%\",height:heightPercent};case\"bottom\":return{bottom:0,left:0,width:\"100%\",height:heightPercent};case\"left\":return{top:0,left:0,width:heightPercent,height:\"100%\"};case\"right\":return{top:0,right:0,width:heightPercent,height:\"100%\"};}};const getVideoStyle=()=>{const baseStyle={width:\"100%\",height:\"100%\",objectFit:objectFit,display:\"block\",filter:`saturate(${saturation}%)`};// Remove resolution-specific max dimensions - let the actual video quality handle it\nreturn baseStyle;};return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoSrc,poster:posterUrl,autoPlay:autoplay,loop:loop,muted:muted,controls:controls,playsInline:true,style:getVideoStyle()}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",...getGradientPosition(),background:getGradientStyle(),pointerEvents:\"none\"}})]});}addPropertyControls(VideoPlayer,{videoSource:{type:ControlType.Enum,title:\"Video Source\",options:[\"url\",\"upload\"],optionTitles:[\"URL\",\"Upload\"],defaultValue:\"url\",displaySegmentedControl:true},videoUrl:{type:ControlType.String,title:\"Video URL\",defaultValue:\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",hidden:({videoSource})=>videoSource!==\"url\"},videoUrlSmall:{type:ControlType.String,title:\"Small (360p)\",placeholder:\"Optional: URL for 360p version\",hidden:({videoSource})=>videoSource!==\"url\"},videoUrlMedium:{type:ControlType.String,title:\"Medium (720p)\",placeholder:\"Optional: URL for 720p version\",hidden:({videoSource})=>videoSource!==\"url\"},videoUrlLarge:{type:ControlType.String,title:\"Large (1080p)\",placeholder:\"Optional: URL for 1080p version\",hidden:({videoSource})=>videoSource!==\"url\"},videoUrlFull:{type:ControlType.String,title:\"Full (4K)\",placeholder:\"Optional: URL for 4K version\",hidden:({videoSource})=>videoSource!==\"url\"},videoFile:{type:ControlType.File,title:\"Upload Video\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"],hidden:({videoSource})=>videoSource!==\"upload\"},resolution:{type:ControlType.Enum,title:\"Resolution\",options:[\"auto\",\"autoLossless\",\"small\",\"medium\",\"large\",\"full\"],optionTitles:[\"Auto\",\"Auto (Lossless)\",\"Small\",\"Medium\",\"Large\",\"Full\"],defaultValue:\"auto\"},playbackControl:{type:ControlType.Enum,title:\"Playback\",options:[\"play\",\"pause\"],optionTitles:[\"▶\",\"⏸\"],defaultValue:\"play\",displaySegmentedControl:true},saturation:{type:ControlType.Number,title:\"Saturation\",defaultValue:100,min:0,max:200,step:1,unit:\"%\"},gradientIntensity:{type:ControlType.Number,title:\"Gradient Intensity\",defaultValue:50,min:0,max:100,step:1,unit:\"%\"},gradientHeight:{type:ControlType.Number,title:\"Gradient Height\",defaultValue:50,min:0,max:100,step:1,unit:\"%\"},gradientDirection:{type:ControlType.Enum,title:\"Gradient Direction\",options:[\"top\",\"bottom\",\"left\",\"right\"],optionTitles:[\"↑\",\"↓\",\"←\",\"→\"],defaultValue:\"bottom\",displaySegmentedControl:true},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},controls:{type:ControlType.Boolean,title:\"Show Controls\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},objectFit:{type:ControlType.Enum,title:\"Object Fit\",options:[\"cover\",\"contain\",\"fill\"],optionTitles:[\"Cover\",\"Contain\",\"Fill\"],defaultValue:\"cover\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoPlayer\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VideoPlayer.map"],"mappings":"gVAMG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,cAAY,MAAM,WAAS,uEAAuE,YAAU,uEAAuE,oBAAkB,GAAG,oBAAkB,SAAS,iBAAe,GAAG,WAAS,GAAK,OAAK,GAAK,QAAM,GAAK,WAAS,GAAM,YAAU,QAAQ,aAAW,IAAI,kBAAgB,OAAO,aAAW,OAAO,gBAAc,iBAAe,gBAAc,eAAa,SAAO,EAAY,EAASA,EAAO,KAAK,CAAM,CAAC,EAAU,GAAcC,EAAS,GAAG,CAAM,CAAC,EAAe,GAAmBA,EAAS,SAAS,CAAM,CAAC,EAAa,GAAiBA,EAAS,EAAE,CAE3pB,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAW,EAAU,YAAY,EAAU,eAAe,EAAU,iBAAiB,GAAG,EAAW,CAAC,IAAM,MAAsB,CAAC,IAAM,EAAS,EAAW,UAAU,EAC/N,EAAgB,EAAS,EAA+E,OAA5E,GAAmB,CAAC,EAAW,iBAAiB,SAAS,EAAkB,KAAW,CAAC,EAAW,oBAAoB,SAAS,EAAkB,IAAM,EAAE,CAAC,CAK0E,IAAM,OAJ9O,CAAC,IAAM,EAAQ,IAAc,MAAM,EAAS,EAAU,GAAG,IAAa,QAAQ,IAAa,eAAe,CACn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