@klever-one/web-sdk
Version:
Web SDK for integrating real-time room management and streaming functionality into web applications
41 lines (40 loc) • 1.48 kB
TypeScript
import { StateManagerCallbacks } from '../types/streaming.types';
/**
* @class StreamStateManager
* @description Manages the complex state of a Streaming connection,
* from initial readiness to ongoing health and quality monitoring.
*/
export declare class StreamStateManager {
private isDataChannelOpen;
private isVideoInitialized;
private isVideoStable;
private videoFrameCallbackHandle;
private state;
private metrics;
private connectionTimeout;
private callbacks;
constructor(callbacks: StateManagerCallbacks);
onDataChannelOpen: () => void;
onVideoInitialized: () => void;
onVideoStalled: () => void;
onVideoResumed: () => void;
onNetworkQualityChanged: (quality: number) => void;
onBitrateChanged: (newBitrate: number) => void;
onResolutionChanged: (width: number, height: number) => void;
onStreamerListMessage: (event: any) => void;
onWebRtcFailed: (reason?: string) => void;
/**
* Starts a timer that will trigger a WebRTC failure if the connection
* is not established within the given timeout period.
* @param timeout - The timeout in milliseconds. Defaults to 60000 (60 seconds).
*/
startConnectionTimer: (timeout?: number) => void;
/**
* Clears the connection timeout timer.
*/
clearConnectionTimer: () => void;
reset: () => void;
private checkReadyState;
private cancelVideoStreamVerification;
private verifyVideoStreamPlayback;
}