UNPKG

@sawport/peers-caller

Version:

WebRTC multi-peer video call library with mesh architecture supporting up to 4 participants

122 lines 3.6 kB
/** * CallParticipant - Manages individual participant in a multi-peer call * Handles participant state, media streams, and peer connections */ import { CallMediaStream } from "./CallMediaStream"; import { CallPeerConnection } from "./CallPeerConnection"; import { type CallStore } from "../store"; import { BaseStore } from "./BaseStore"; import type { CallParticipant as ICallParticipant, PeerConnectionConfig } from "../types"; export declare class CallParticipant extends BaseStore<CallStore> { private userId; private mediaStream; private peerConnections; private remoteStreams; private isLocalParticipant; private callbacks; constructor(userId: string, callbacks?: CallParticipant["callbacks"], isLocalParticipant?: boolean); /** * Initialize participant with media stream */ initialize(constraints?: { video: boolean; audio: boolean; }): Promise<void>; /** * Create peer connection to another participant */ createPeerConnection(remoteUserId: string, config: PeerConnectionConfig, isInitiator: boolean): Promise<void>; /** * Get peer connection to specific user */ getPeerConnection(remoteUserId: string): CallPeerConnection | undefined; /** * Signal to a specific peer */ signalToPeer(remoteUserId: string, data: any): void; /** * Toggle audio for this participant */ toggleAudio(enabled: boolean): void; /** * Toggle video for this participant */ toggleVideo(enabled: boolean): void; /** * Start screen sharing */ startScreenShare(): Promise<void>; /** * Stop screen sharing */ stopScreenShare(): Promise<void>; /** * Get current participant state */ getState(): ICallParticipant; /** * Get participant's user ID */ getUserId(): string; /** * Get participant's media stream */ getMediaStream(): CallMediaStream | null; /** * Get participant's current stream */ getCurrentStream(): MediaStream | undefined; /** * Get participant's video element */ getVideoElement(): HTMLVideoElement | undefined; /** * Get remote stream from specific participant */ getRemoteStream(fromUserId: string): MediaStream | undefined; /** * Get all remote streams */ getAllRemoteStreams(): Map<string, MediaStream>; /** * Get all peer connections */ getAllPeerConnections(): Map<string, CallPeerConnection>; /** * Get connection status with all peers */ getConnectionStatus(): Record<string, boolean>; /** * Remove peer connection */ removePeerConnection(remoteUserId: string): void; /** * Update participant state and notify store and callbacks */ private updateState; /** * Get participant info for debugging */ getDebugInfo(): { userId: string; state: ICallParticipant; peerConnections: string[]; remoteStreams: string[]; connectionStatus: Record<string, boolean>; mediaStreamInfo: { id: string; videoTracks: number; audioTracks: number; isScreenShare: boolean; videoEnabled: boolean; audioEnabled: boolean; videoConstraints: MediaTrackSettings | null; audioConstraints: MediaTrackSettings | null; } | null | undefined; }; /** * Cleanup participant resources */ cleanup(): void; } //# sourceMappingURL=CallParticipant.d.ts.map