@klever-one/web-sdk
Version:
Web SDK for integrating real-time room management and streaming functionality into web applications
82 lines (81 loc) • 3.08 kB
TypeScript
import { PixelStreaming } from '@epicgames-ps/lib-pixelstreamingfrontend-ue5.4';
import { ConnectionStatus, StreamingConnectionConfig } from '../types';
import { StreamingUIService } from './streaming-ui.service';
/**
* Streaming 연결 관리를 담당하는 서비스
* 책임: 연결/연결해제, 상태 관리, 재연결 로직
*/
export declare class StreamingConnectionService {
private static instance;
private stream;
private application;
private currentStatus;
private hasSentResetMessage;
private onWebRtcConnectedHandler;
private onWebRtcDisconnectedHandler;
private onWebRtcPlayStreamErrorHandler;
private onWebRtcFailedEventHandler;
private beforeUnloadHandler;
private reconnectTimeout;
private hasFailedConnection;
private reconnectAttempts;
private maxReconnectAttempts;
private isDisconnecting;
private signalingServerUrl;
private config;
private eventBus;
private statusListeners;
private disconnectListeners;
private eventUnsubscribeFunctions;
private keepAliveInterval;
private uiService;
private mediaService;
private readyStateManager;
private initialAudioTrack;
private lockedAudioElement;
private constructor();
static getInstance(): StreamingConnectionService;
/**
* Epic Games 라이브러리를 dynamic import로 로드 (SSR-safe)
*/
private loadEpicGamesLibraries;
private onStreamReady;
private onStreamStalled;
private onStreamResumed;
private onStreamMetricsUpdate;
private onStreamerListUpdate;
private onWebRtcFailed;
private cleanupEventListeners;
private setupEventListeners;
private reset;
/**
* 중앙화된 데이터 채널 전송 메서드
* 모든 emitUIInteraction 호출을 이 메서드를 통해 래핑
*/
private emitToDataChannel;
setContainer(element: HTMLElement | null): void;
forceResetContainer(element: HTMLElement | null): void;
connect(signalingServerUrl: string, config?: StreamingConnectionConfig): Promise<void>;
private createStreamingConnection;
private registerEventHandlers;
private unregisterEventHandlers;
setupLockedAudio(stream: PixelStreaming): void;
private createLockedAudio;
disconnect(): void;
performDisconnect(): void;
reconnect(): Promise<void>;
private scheduleReconnect;
private setStatus;
private getConnectionEventType;
private notifyDisconnectListeners;
updateInputOptions(mouseEnabled: boolean, keyboardEnabled: boolean): void;
getStatus(): ConnectionStatus;
getStream(): PixelStreaming | null;
getUIService(): StreamingUIService;
addStatusListener(listener: (status: ConnectionStatus) => void): void;
removeStatusListener(listener: (status: ConnectionStatus) => void): void;
addDisconnectListener(listener: () => void): void;
removeDisconnectListener(listener: () => void): void;
addResponseListener(listener: (response: string) => void): void;
removeResponseListener(_: (response: string) => void): void;
}