import{r as v,j as c}from"./index-D2K-duz6.js";function j({props:S,paused:l,onMediaLoadingChange:t}){const u=S,m=String(u.caption??"").trim(),s=String(u.videoSrc??"").trim(),x=String(u.posterSrc??"").trim(),f=v.useRef(null);return v.useEffect(()=>{const r=f.current;if(!r)return;if(l){r.pause();return}const p=r.play();p&&typeof p.catch=="function"&&p.catch(()=>{})},[l,s]),v.useEffect(()=>{if(!s){t==null||t(!1);return}return t==null||t(!0),()=>{t==null||t(!1);const r=f.current;r&&(r.pause(),r.currentTime=0)}},[t,s]),c.jsxs("article",{className:`fullscreen-video-center-caption ${l?"fullscreen-video-center-caption--paused":""}`,children:[c.jsx("video",{ref:f,className:"fullscreen-video-center-caption__media",src:s,poster:x||void 0,autoPlay:!0,playsInline:!0,preload:"metadata",controls:!1,onLoadedData:()=>t==null?void 0:t(!1),onCanPlay:()=>t==null?void 0:t(!1),onPlaying:()=>t==null?void 0:t(!1),onLoadStart:()=>t==null?void 0:t(!0),onWaiting:()=>t==null?void 0:t(!0),onStalled:()=>t==null?void 0:t(!0),onSuspend:()=>t==null?void 0:t(!1),onEnded:()=>t==null?void 0:t(!1),onError:()=>t==null?void 0:t(!1)}),m?c.jsx("div",{className:"fullscreen-video-center-caption__overlay",children:c.jsx("p",{className:"fullscreen-video-center-caption__caption",children:m})}):null]})}export{j as default};
