{"version":3,"file":"AutoplayVideo.DWR1Bp-R.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/0UiwV9XKfenkStyeluLP/AHx4mndruEeMUKc1649d/AutoplayVideo.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function VideoWithMuteToggle(props){const{videoSrc,poster,hideSoundIcon,videoAutoPlay,hideControls,loop}=props;const[playIconShow,setPlayIconShow]=useState(!props.videoAutoPlay&&!props.hidePlayIcon);const[muted,setMuted]=useState(!hideSoundIcon||videoAutoPlay);const[posterReady,setPosterReady]=useState(false);const videoRef=useRef(null);useEffect(()=>{if(!props.videoAutoPlay)return;const video=videoRef.current;if(!video)return;const handleVolumeChange=()=>{setMuted(video.muted);};video.addEventListener(\"volumechange\",handleVolumeChange);return()=>{video.removeEventListener(\"volumechange\",handleVolumeChange);};},[]);const toggleMute=()=>{if(videoRef.current){videoRef.current.muted=!videoRef.current.muted;setMuted(videoRef.current.muted);}};const togglePlay=()=>{if(videoRef.current){videoRef.current.play();setPlayIconShow(false);}};return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                .btn {\n                    padding: 8px 12px;\n                    border-radius: 8px;\n                    border: none;\n                    background: white;\n                    cursor: pointer;\n                    font-weight: bold;\n                    transition: background 0.2s ease;\n                }\n\n                .btn:hover {\n                    background: #eee;\n                }\n                .playBtn{\n                    position: absolute;\n                    top: calc(50% - 26px);\n                    right: calc(50% - 26px);\n                    cursor: pointer;\n                    zIndex: 10\";\n                \n                }\n\n                .player{\n                    min-height: 300px;\n                }\n\n                @media screen and (max-width: 600px) {\n                    .player {\n                        min-height: 47vw;\n                    }\n                }   \n\n            `}),/*#__PURE__*/_jsx(\"link\",{rel:\"preload\",as:\"image\",href:poster,fetchpriority:\"high\",type:\"image/jpeg\"}),/*#__PURE__*/_jsx(\"img\",{src:poster,alt:\"video cover\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:posterReady||!poster?\"none\":\"block\"}}),/*#__PURE__*/_jsx(\"video\",{className:\"player\",ref:videoRef,src:videoSrc,// poster={poster}\ncontrols:!playIconShow&&!hideControls,autoPlay:props.videoAutoPlay,loop:loop,playsInline:true,muted:muted,style:{width:\"100%\",height:\"100%\",borderRadius:\"12px\",objectFit:\"cover\",display:posterReady||!poster?\"block\":\"none\"},onLoadedData:()=>setPosterReady(true)}),playIconShow&&/*#__PURE__*/_jsx(\"div\",{className:\"playBtn\",onClick:togglePlay,children:/*#__PURE__*/_jsx(\"img\",{style:{width:\"52px\",height:\"52px\"},src:\"https://static-hb.clipp.ai/static-files/83c1gb7g/1dLFIX0U4hByMzAl.webp\",alt:\"Play Icon\"})}),/*#__PURE__*/_jsx(\"style\",{children:`\n                      .sounded-btn{\n                    background: #FFFFFF1a;\n                    padding: 8px;\n                    border-radius: 100px;\n                    backdrop-filter: blur(12px);\n                }\n                .sounded-btn:hover{\n                    background: #FFFFFF4D;\n                }`}),!hideSoundIcon&&/*#__PURE__*/_jsxs(\"div\",{className:\"sounded-btn\",style:{position:\"absolute\",top:\"12px\",right:\"12px\",width:\"48px\",height:\"48px\",cursor:\"pointer\",zIndex:\"10\"},onClick:toggleMute,children:[/*#__PURE__*/_jsx(\"img\",{style:{width:\"32px\",height:\"32px\",display:muted?\"block\":\"none\"},src:\"https://static-hb.clipp.ai/static-files/83c1gb7g/extmUKcLAaouTO3Z.webp\",alt:\"Mute toggle\"}),/*#__PURE__*/_jsx(\"img\",{style:{width:\"32px\",height:\"32px\",display:!muted?\"block\":\"none\"},src:\"https://static-hb.clipp.ai/static-files/83c1gb7g/kYM04QmsObfW3oIz.webp\",alt:\"Mute toggle\"})]})]});}// 添加 Framer 控制面板参数（Canvas 可视化配置）\naddPropertyControls(VideoWithMuteToggle,{videoSrc:{title:\"Video URL\",type:ControlType.String,defaultValue:\"https://static-hb.clipp.ai/static-files/83c1gb7g/9FkftoTwg_HluOWk.mp4\"},poster:{title:\"Poster Image\",type:ControlType.String},videoAutoPlay:{title:\"Video Autoplay\",type:ControlType.Boolean,defaultValue:false},hidePlayIcon:{title:\"Hide Play Icon\",type:ControlType.Boolean,defaultValue:false},hideControls:{title:\"Hide Controls\",type:ControlType.Boolean,defaultValue:false},loop:{title:\"Loop\",type:ControlType.Boolean,defaultValue:true},hideSoundIcon:{title:\"hide Sound Icon\",type:ControlType.Boolean,defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoWithMuteToggle\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AutoplayVideo.map"],"mappings":"+LAA0J,SAAwB,EAAoB,EAAM,CAAC,GAAK,CAAC,WAAS,SAAO,gBAAc,gBAAc,eAAa,QAAM,EAAW,CAAC,EAAa,GAAiBA,EAAS,CAAC,EAAM,eAAe,CAAC,EAAM,YAAY,EAAO,CAAC,EAAM,GAAUA,EAAS,CAAC,GAAe,CAAa,EAAO,CAAC,EAAY,GAAgBA,EAAS,EAAK,EAAQ,EAASC,EAAO,IAAI,EAAyf,OAAvf,MAAc,CAAC,GAAG,CAAC,EAAM,cAAc,OAAO,IAAM,EAAM,EAAS,QAAQ,GAAG,CAAC,EAAM,OAAO,IAAM,MAAuB,CAAC,EAAS,EAAM,KAAK,CAAE,EAA4D,OAA1D,EAAM,iBAAiB,eAAe,CAAkB,MAAY,CAAC,EAAM,oBAAoB,eAAe,CAAkB,CAAE,CAAE,EAAE,CAAC,CAAC,EAAiP,EAAM,MAAM,CAAC,MAAM,CAAC,SAAS,WAAW,MAAM,OAAO,OAAO,MAAM,EAAE,SAAS,CAAc,EAAK,QAAQ,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAiC5mC,CAAC,EAAe,EA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