{"version":3,"file":"Transparentvideofinal.2DTOISVW.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/Lx0BspiwlJrBnrmDmDiK/aq6tGDeVSN3PdKH1TXOX/Transparentvideofinal.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,useRef}from\"react\";/**\n * Transparent Video (WebM + HEVC alpha)\n *\n * Each asset can be an uploaded File OR a URL (URL wins when both are set).\n *\n * Source is chosen per-browser, NOT by <source> order, because modern\n * Safari plays WebM but ignores its alpha (renders opaque). So:\n *   - Safari / any iOS browser (all WebKit) -> HEVC mp4 (hvc1)\n *   - Everyone else (Chrome, Firefox, Edge...) -> WebM (reliable VP9 alpha)\n *\n * Sound: the video always autoplays MUTED (browser policy). On hover it\n * unmutes; on mouse-leave it mutes again. Hover is a user interaction, so\n * unmuting an already-playing video is allowed. Touch devices (iOS) have no\n * hover, so audio simply stays muted there.\n *\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function TransparentVideoFinal(props){const{webmFile,webmURL,mp4File,mp4URL,posterFile,posterURL,fit,autoplay,loop,soundOnHover,volume,style}=props;// URL takes precedence over an uploaded file\nconst webm=(webmURL||\"\").trim()||webmFile||\"\";const mp4=(mp4URL||\"\").trim()||mp4File||\"\";const poster=(posterURL||\"\").trim()||posterFile||\"\";const[src,setSrc]=useState(null);const videoRef=useRef(null);useEffect(()=>{const ua=navigator.userAgent;const isIOS=/iphone|ipad|ipod/i.test(ua)||// iPadOS 13+ reports as Mac but has a touch screen\nnavigator.platform===\"MacIntel\"&&navigator.maxTouchPoints>1;const isMacSafari=/safari/i.test(ua)&&!/chrome|chromium|crios|fxios|android|edg|opr/i.test(ua);const useHEVC=isIOS||isMacSafari;// Fall back to the other file if the preferred one is empty\nconst chosen=useHEVC?mp4||webm:webm||mp4;setSrc(chosen||null);},[webm,mp4]);// Unmute on hover / mute on leave — done via ref so it doesn't re-render\n// (a re-render would reset the muted attribute).\nconst handleEnter=()=>{if(!soundOnHover)return;const v=videoRef.current;if(!v)return;v.volume=Math.min(1,Math.max(0,volume));v.muted=false;// Some browsers pause a freshly-unmuted video; nudge it to keep playing.\nconst p=v.play();if(p&&typeof p.catch===\"function\")p.catch(()=>{});};const handleLeave=()=>{const v=videoRef.current;if(!v)return;v.muted=true;};const wrapperStyle={width:\"100%\",height:\"100%\",position:\"relative\",...style};const mediaStyle={width:\"100%\",height:\"100%\",objectFit:fit,display:\"block\"};// Before we know the browser, show the poster (or nothing) instead of\n// loading a source. This prevents Safari from grabbing the webm.\nif(!src){return /*#__PURE__*/_jsx(\"div\",{style:wrapperStyle,children:poster?/*#__PURE__*/_jsx(\"img\",{src:poster,alt:\"\",style:mediaStyle}):/*#__PURE__*/_jsx(\"div\",{style:mediaStyle})});}return /*#__PURE__*/_jsx(\"div\",{style:wrapperStyle,onMouseEnter:handleEnter,onMouseLeave:handleLeave,children:/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:src,style:mediaStyle,poster:poster||undefined,autoPlay:autoplay,loop:loop,muted:true,playsInline:true,preload:\"auto\"},`${src}|${autoplay}|${loop}`)});}TransparentVideoFinal.defaultProps={webmFile:\"\",webmURL:\"\",mp4File:\"\",mp4URL:\"\",posterFile:\"\",posterURL:\"\",fit:\"contain\",autoplay:true,loop:true,soundOnHover:true,volume:1};addPropertyControls(TransparentVideoFinal,{webmFile:{type:ControlType.File,title:\"WebM\",allowedFileTypes:[\"webm\"]},webmURL:{type:ControlType.String,title:\"WebM URL\",placeholder:\"https://...webm\"},mp4File:{type:ControlType.File,title:\"MP4 (HEVC)\",allowedFileTypes:[\"mp4\",\"mov\"]},mp4URL:{type:ControlType.String,title:\"MP4 URL\",placeholder:\"https://...mp4\"},posterFile:{type:ControlType.File,title:\"Poster\",allowedFileTypes:[\"png\",\"jpg\",\"jpeg\",\"webp\"]},posterURL:{type:ControlType.String,title:\"Poster URL\",placeholder:\"https://...png\"},fit:{type:ControlType.Enum,title:\"Fit\",options:[\"contain\",\"cover\",\"fill\"],optionTitles:[\"Contain\",\"Cover\",\"Fill\"],defaultValue:\"contain\",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\"},soundOnHover:{type:ControlType.Boolean,title:\"Sound on Hover\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},volume:{type:ControlType.Number,title:\"Volume\",defaultValue:1,min:0,max:1,step:.05,displayStepper:true,hidden:props=>!props.soundOnHover}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TransparentVideoFinal\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Transparentvideofinal.map"],"mappings":"uMAkBG,SAAwB,EAAsB,EAAM,CAAC,GAAK,CAAC,WAAS,UAAQ,UAAQ,SAAO,aAAW,YAAU,MAAI,WAAS,OAAK,eAAa,SAAO,SAAO,EAC1J,GAAM,GAAS,GAAA,CAAI,KAAK,GAAG,GAAU,GAAS,GAAK,GAAQ,GAAA,CAAI,KAAK,GAAG,GAAS,GAAS,GAAQ,GAAW,GAAA,CAAI,KAAK,GAAG,GAAY,GAAQ,CAAC,EAAI,GAAQA,EAAS,IAAI,EAAQ,EAASC,EAAO,IAAI,EAAE,MAAc,CAAC,IAAM,EAAG,EAAU,UAAgB,EAAM,oBAAoB,KAAK,CAAE,GAC7R,EAAU,WAAW,YAAY,EAAU,eAAe,EAAQ,EAAY,UAAU,KAAK,CAAE,GAAG,CAAC,+CAA+C,KAAK,CAAE,EAChH,GADgI,GAAO,EAC3J,GAAK,EAAK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