{"version":3,"file":"VideoPlayer.Ba5XTJ0P.mjs","names":["useRef","__esmMin","c","init_jsx_runtime","ce","init_npm_react_18_3_1","de","init_framer_B1b760uK","RenderTarget","addPropertyControls","VideoPlayer","videoRef","isStatic","playOnView","node","observer","entry","entries","poster","init_VideoPlayer","ControlType"],"sources":["https:/framerusercontent.com/modules/FueLCl7iyvDN6nQQdCx3/JXVIVPcsKHmUto0vyNrj/VideoPlayer.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function VideoPlayer({src,poster,playOnView=false,loop=false,controls=true}){const videoRef=useRef(null);const isStatic=RenderTarget.current()!==RenderTarget.preview&&RenderTarget.hasRestrictions();useEffect(()=>{if(!playOnView||isStatic)return;const node=videoRef.current;if(!node)return;const observer=new IntersectionObserver(entries=>{for(const entry of entries){if(entry.isIntersecting){node.play().catch(()=>{});observer.disconnect();}}},{threshold:.5});observer.observe(node);return()=>observer.disconnect();},[playOnView,isStatic]);return /*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:src,poster:poster||undefined,muted:playOnView?true:undefined,loop:loop,controls:controls,playsInline:true,preload:\"metadata\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}});}addPropertyControls(VideoPlayer,{src:{type:ControlType.String,title:\"Video URL\"},poster:{type:ControlType.String,title:\"Poster Image URL\",optional:true},playOnView:{type:ControlType.Boolean,title:\"Play On View\",description:\"Autoplays (muted) once the video scrolls into view\",defaultValue:false},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false},controls:{type:ControlType.Boolean,title:\"Show Controls\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoPlayer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupport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