PageSourceSearch

https://beta.telegames.ai/_next/static/chunks/6386.d9a2d130a41a9df0.js

js telegames.ai collected 2026-10-05 13:58:28 UTC 7,548 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6386],{86386:(e,t,l)=>{l.r(t),l.d(t,{default:()=>u});var n=l(97244),a=l(68080),o=l(33227),d=l(23368),i=l(45774);let r=new Map;function u(e){var t,l;let{socket:u,roomId:s,observerToken:c,controllerSessionId:v,audioEnabled:p,roomName:m,backgroundImageUrl:f}=e,[R,h]=(0,a.useState)(null),[E,g]=(0,a.useState)(null),[A,T]=(0,a.useState)(0),y=A>0,I=A>=2,_=3===A,k=(0,a.useRef)(!1);k.current=_;let D=(0,a.useRef)(null),b=(0,a.useCallback)(e=>{D.current=e},[]);(0,a.useEffect)(()=>{_||(D.current=null)},[_]);let[O,C]=(0,a.useState)("Waiting for the other participant…"),[P,S]=(0,a.useState)("Waiting for the host camera…"),x=(0,a.useRef)(null),w=(0,a.useRef)(null),j=(0,a.useRef)(null),M=(0,a.useRef)(null),N=(0,a.useRef)(c);N.current=c;let V=(0,a.useRef)(p);return V.current=p,(0,a.useEffect)(()=>{let e=!1,t=e=>{if((0,o.cFx)(e)&&e.roomId===s){if(e.sessionId===v){g(t=>(null==t?void 0:t.path)===e.path?t:e);return}h(t=>(null==t?void 0:t.path)===e.path?t:null!=t?t:e)}},l=e=>{(null==e?void 0:e.roomId)===s&&h(t=>(null==t?void 0:t.sessionId)===e.sessionId?null:t),(null==e?void 0:e.roomId)===s&&g(t=>(null==t?void 0:t.sessionId)===e.sessionId?null:t)},n=()=>{h(null),g(null),C("Reconnecting…")},a=()=>{h(null),g(null),C("Room access unavailable. Reconnect the TV.")},d=async()=>{let t=await (0,o.GaV)(N.current);!e&&u.connected&&u.emit(o.REg.JOIN_USER_REQUEST,s,{alias:"__program_observer__",sessionId:t,socketId:u.id,isHost:!1,roomId:s,type:o.yJM.PROGRAM_OBSERVER},N.current)},i=()=>{d().catch(a)};return u.on(o.REg.PARTICIPANT_PROGRAM_MEDIA_READY,t),u.on(o.REg.PARTICIPANT_PROGRAM_MEDIA_STOPPED,l),u.on(o.REg.PARTICIPANT_PROGRAM_MEDIA_ERROR,l),u.on(o.REg.JOIN_USER_DENIED,a),u.on("connect",i),u.on("disconnect",n),u.connected?i():u.connect(),()=>{e=!0,u.off(o.REg.PARTICIPANT_PROGRAM_MEDIA_READY,t),u.off(o.REg.PARTICIPANT_PROGRAM_MEDIA_STOPPED,l),u.off(o.REg.PARTICIPANT_PROGRAM_MEDIA_ERROR,l),u.off(o.REg.JOIN_USER_DENIED,a),u.off("connect",i),u.off("disconnect",n)}},[u,s,v]),(0,a.useEffect)(()=>{M.current&&(M.current.muted=!p)},[p]),(0,a.useEffect)(()=>{if(!R||!x.current)return;let e=!1,t=!1,l=null,n=0,a=0,i=0,r=document.createElement(y?"video":"audio");r.autoplay=!0,r.muted=!V.current,r.volume=1,r instanceof HTMLVideoElement&&(r.playsInline=!0,r.style.cssText="width:640px;max-height:360px;background:black"),x.current.appendChild(r),M.current=r;let u=new d.g({whepUrl:(0,o.zGA)(R.path),getObserverToken:()=>N.current,receiveVideo:y,maxReconnectAttempts:0,onStream:t=>{e||(l=t,r.srcObject!==t&&(r.srcObject=t),r.play().catch(()=>{e||C("Playback was rejected by the browser.")}))},onStateChange:t=>{e||C("live"===t?"Listen while the other participant speaks.":t)},onError:()=>{e||C("Media connection failed.")}}),s=async()=>{if(!t&&!e){t=!0;try{var o,d,s,c,v,p,m,f;let t=await u.getDiagnostics();if(e)return;let R=Date.now(),h=null==t?void 0:t.audio,E=null==t?void 0:t.video;(null!==(v=null==E?void 0:E.framesDecoded)&&void 0!==v?v:0)>a&&(a=E.framesDecoded,n=R);let g=null!==(p=null===(o=D.current)||void 0===o?void 0:o.lastPresentedAt)&&void 0!==p?p:0,A=!k.current||g>0&&R-g<3e3,T="live"===u.getState()&&r.readyState>=2&&!r.error&&A;T&&(!y||R-n<3e3)&&(i=R),window.__TV_DIRECT_STATUS={ready:T,sourcesReady:T,mediaReady:T,supported:!0,updatedAt:R,presentedAt:k.current?Math.min(i,g):i,canvasMetrics:k.current?null===(d=D.current)||void 0===d?void 0:d.tvRenderMetrics:null,audioRequested:V.current,audioOutputRoute:"media-element",audioOutputConnected:!!l,audioOutputMuted:r.muted,audioOutputPaused:r.paused,audioOutputReadyState:r.readyState,audioOutputVolume:r.volume,participantDiagnostics:[{isController:!1,lastFrameAt:n,videoTrackCount:null!==(m=null==l?void 0:l.getVideoTracks().length)&&void 0!==m?m:0,audioTrackCount:null!==(f=null==l?void 0:l.getAudioTracks().length)&&void 0!==f?f:0,audioTrackMuted:null==l?void 0:null===(s=l.getAudioTracks()[0])||void 0===s?void 0:s.muted,audioTrackEnabled:null==l?void 0:null===(c=l.getAudioTracks()[0])||void 0===c?void 0:c.enabled,audioBytesReceived:null==h?void 0:h.bytesReceived,audioPacketsReceived:null==h?void 0:h.packetsReceived,audioPacketsLost:null==h?void 0:h.packetsLost,audioJitter:null==h?void 0:h.jitter,audioConcealedSamples:null==h?void 0:h.concealedSamples,audioConcealmentEvents:null==h?void 0:h.concealmentEvents,audioJitterBufferDelay:null==h?void 0:h.jitterBufferDelay,audioJitterBufferEmittedCount:null==h?void 0:h.jitterBufferEmittedCount,audioLevel:null==h?void 0:h.audioLevel,totalAudioEnergy:null==h?void 0:h.totalAudioEnergy,totalSamplesDuration:null==h?void 0:h.totalSamplesDuration,framesDecoded:null==E?void 0:E.framesDecoded,framesDropped:null==E?void 0:E.framesDropped,bytesReceived:null==E?void 0:E.bytesReceived,packetsLost:null==E?void 0:E.packetsLost},...j.current?[j.current]:[]]}}catch(e){}finally{t=!1}}};u.start();let c=setInterval(()=>{s()},500);return()=>{e=!0,clearInterval(c),r.pause(),r.srcObject=null,r.remove(),M.current=null,u.stop(),window.__TV_DIRECT_STATUS={ready:!1}}},[R,y]),(0,a.useEffect)(()=>
1{if(!I||!E||!w.current)return;let e=!1,t=!1,l=0,n=0,a=null,i=document.createElement("video");i.autoplay=!0,i.playsInline=!0,i.muted=!0,i.style.cssText="width:640px;max-height:360px;background:black",w.current.appendChild(i);let r=new d.g({whepUrl:(0,o.zGA)(E.path),getObserverToken:()=>N.current,receiveAudio:!1,maxReconnectAttempts:0,onStream:t=>{e||(a=t,i.srcObject!==t&&(i.srcObject=t),i.play().catch(()=>{e||S("Host camera playback was rejected.")}))},onStateChange:t=>{e||S("live"===t?"Host camera — microphone excluded":t)},onError:()=>{e||S("Host camera connection failed.")}}),u=async()=>{if(!e&&!t){t=!0;try{var o,d,i;let t=await r.getDiagnostics();if(e)return;let u=null==t?void 0:t.video;(null!==(o=null==u?void 0:u.framesDecoded)&&void 0!==o?o:0)>l&&(l=u.framesDecoded,n=Date.now()),j.current={isController:!0,lastFrameAt:n,audioTrackCount:null!==(d=null==a?void 0:a.getAudioTracks().length)&&void 0!==d?d:0,videoTrackCount:null!==(i=null==a?void 0:a.getVideoTracks().length)&&void 0!==i?i:0,framesDecoded:null==u?void 0:u.framesDecoded,framesDropped:null==u?void 0:u.framesDropped,bytesReceived:null==u?void 0:u.bytesReceived,packetsLost:null==u?void 0:u.packetsLost}}catch(e){}finally{t=!1}}};r.start();let s=setInterval(()=>{u()},500);return()=>{e=!0,clearInterval(s),j.current=null,i.pause(),i.srcObject=null,i.remove(),r.stop()}},[I,E]),(0,n.jsxs)("main",{className:"fixed inset-0 bg-black text-white p-12 text-2xl",children:[_&&(0,n.jsx)(i.A,{peers:r,canvasWidth:1280,canvasHeight:720,targetFrameRate:30,renderClock:"display",renderParticipantVideoInCanvas:!1,roomName:m,backgroundImageUrl:f,onCanvasReady:b}),(0,n.jsxs)("div",{className:"relative z-10",children:[(0,n.jsxs)("h1",{children:["TV media test — ",_?"Stage canvas + two videos":I?"Two videos":y?"Audio + video":"Audio only"]}),(0,n.jsxs)("p",{className:"my-4",children:[null!==(t=null==R?void 0:R.alias)&&void 0!==t?t:"Other participant"," \xb7 ",p?"TV sound ON":"TV sound OFF"]}),(0,n.jsx)("p",{className:"my-4",children:O}),I&&(0,n.jsxs)("p",{className:"my-4",children:[null!==(l=null==E?void 0:E.alias)&&void 0!==l?l:"Host"," \xb7 ",P]}),(0,n.jsxs)("div",{className:"flex gap-4",children:[(0,n.jsx)("div",{ref:x}),(0,n.jsx)("div",{ref:w})]}),(0,n.jsx)("button",{className:"mt-8 border-4 p-4 focus:bg-blue-800",onClick:()=>T(e=>(e+1)%4),children:_?"Test audio only":I?"Add stage canvas":y?"Add host video":"Test audio + video"})]})]})}}}]);
2//# sourceMappingURL=6386.d9a2d130a41a9df0.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.