1import{R as h,r as s,bp as j,j as n,a as g,dg as P,b as y,dh as D}from"./react-DwuEVfNv.js";import{c,j as M,s as S,gb as z,r as F,k as N,a3 as B}from"./index-DQzPtNsy.js";import{aa as C}from"./d3-q0zOtUjj.js";import{M as O}from"./MissingPlaybackId-BslKbgmL.js";const U=r=>{const e=h.useRef(0),i=h.useRef(0),t=u=>{if(i.current!==void 0){const a=u-i.current;r(a)}i.current=u,e.current=requestAnimationFrame(t)};h.useEffect(()=>(e.current=requestAnimationFrame(t),()=>cancelAnimationFrame(e.current)),[])},q=(r,e)=>{if(r.paused||r.ended)return[];e.fftSize=256;const i=e.fftSize,t=new Uint8Array(i);return e.getByteTimeDomainData(t),Array.from(t)},H=({playerRef:r,hasInteracted:e})=>{const i=s.useRef(),t=s.useRef(null),[u,a]=s.useState(new Array(256).fill(128)),[{width:f,height:m},p]=s.useState({width:0,height:0}),d=r.current?.media?.nativeEl;s.useEffect(()=>{if(!e||!d)return;const o=new AudioContext;i.current=o.createAnalyser(),o.createMediaElementSource(d).connect(i.current),i.current.connect(o.destination)},[d,e]),s.useEffect(()=>{function o(){if(!t.current)return;const{width:l,height:w}=t.current.getBoundingClientRect();p({width:l,height:w})}return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),U(h.useCallback(()=>{if(!r.current||!i.current)return;const o=q(r.current,i.current);o&&a(o)},[r]));const x=j({domain:[0,255],range:[0,f]}),v=j({domain:[0,255],range:[0,m]});return n.jsxs(W,{width:"100%",height:"100%",ref:t,children:[n.jsx("rect",{width:"100%",height:"100%",fill:c.gray20}),n.jsx(P,{curve:C,data:u,x:(o,l)=>x(l),y:o=>v(o),stroke:c.pink60,strokeWidth:2,strokeOpacity:1,shapeRendering:"geometricPrecision"})]})};var W=g("svg")(["display:block;"]);const A="https://image.mux.com",K="https://stream.mux.com",_="gu5i180vl80c17hktdklmpu5j",V=void 0,Y=g(N).attrs({xAlign:"center",yAlign:"center"})(["background-color:",";position:relative;aspect-ratio:16 / 9;width:100%;height:100%;overflow:hidden;"],c.gray40),I=g(B)(["text-transform:uppercase;position:absolute;top:",";left:",";background-color:",";border-radius:",";color:",";padding:4px 3px;font-size:9px;"],S[2],S[2],z(c.gray80,.8),F[1],c.gray20),G=g.span(["background-color:",";border-radius:100%;margin-right:3px;height:1em;width:1em;",";"],c.gray40,({$status:r})=>r==="active"&&y(["background-color:",";"],c.red50)),J=({streamType:r,playbackId:e,environmentId:i,assetType:t,playable:u,status:a,thumbnailTime:f,startTime:m,primaryColor:p,secondaryColor:d,accentColor:x,metadata:v,paused:o,onTimeUpdate:l,onPlay:w,playerRef:R})=>{const k=s.useRef(null),b=R??k,[E,L]=h.useState(!1),$=h.useMemo(()=>({streamType:r,startTime:m,envKey:_,src:`${K}/${e}.m3u8`,storyboardSrc:`${A}/${e}/storyboard.vtt`,audio:t==="audio",...t!=="audio"&&{poster:`${A}/${e}/thumbnail.jpg?width=800&height=450${f==null?"":`&time=${f}`}`},...V,primaryColor:p,secondaryColor:d,accentColor:x,metadata:v??{property_key:_,player_name:`Mux ${t==="audio"?"Audio":""} Player`,player_init_time:Date.now(),video_series:"dashboard",video_id:e,video_title:e,sub_property_id:i}}),[x,t,i,v,e,p,d,m,r,f]);return n.jsx(X,{children:u?n.jsxs(n.Fragment,{children:[t==="audio"&&n.jsx("div",{children:n.jsx(H,{hasInteracted:E,playerRef:b})}),n.jsx(Q,{paused:o,onTimeUpdate:l,onPlay:()=>{L(!0),w?.()},ref:b,playsInline:!0,...$,$_css:t==="audio"?y(["width:calc(100% + 2px);--seek-backward-button:none;--seek-forward-button:none;--playback-rate-button:none;&::part(bottom volume range){padding-right:10px;}"]):y(["aspect-ratio:16 / 9;"])})]}):n.jsxs(n.Fragment,{children:[a&&n.jsxs(I,{yAlign:"center",children:[n.jsx(G,{$status:a}),n.jsx("span",{children:a})]}),n.jsx(M,{height:t==="video"?"100%":"42px",aspectRatio:t==="video"?"16 / 9":void 0})]})})};function re(r){const{playbackId:e,playerRef:i,thumbnailTime:t}=r;return n.jsx(Y,{children:e?n.jsx(J,{...r,playbackId:e,playerRef:i,thumbnailTime:t}):n.jsx(O,{})})}var Q=g(D)(["width:100%;",""],r=>r.$_css),X=g("div")(["width:100%;position:relative;overflow:hidden;"]);export{re as PlaybackSample}; 2//# sourceMappingURL=PlaybackSample-ETXJJ3JN.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.