import type { PlayerState } from '../core/player-state.js'; import type { ClientMessage, CollabParticipant } from '@vizor-vr/shared'; export interface CollabClientOptions { serverUrl: string; roomCode: string; role: 'host' | 'viewer'; userId: string; displayName: string; state: PlayerState; /** The media element for play/pause/seek control */ mediaElement: { play(): void | Promise; pause(): void; seek(time: number): void; currentTime: number; }; /** Optional callback when participants change */ onParticipantsChange?: (users: CollabParticipant[]) => void; /** Callback when a peer's gaze position is received */ onPeerGaze?: (userId: string, lat: number, lon: number) => void; /** Callback when a user joins the room */ onUserJoined?: (user: CollabParticipant) => void; /** Callback when a user leaves the room */ onUserLeft?: (userId: string) => void; /** Callback when a chat message is received */ onChatMessage?: (userId: string, displayName: string, text: string, timestamp: number) => void; /** Callback when a voice signal (SDP/ICE) is received from a peer */ onVoiceSignal?: (fromUserId: string, sdp?: string, candidate?: string) => void; /** Room password (host sets, viewers must match) */ password?: string; } /** * Browser-side WebSocket client for collaborative viewing. * * - Host: subscribes to local state changes → sends playback_state/seek to server * - Viewer: receives sync messages → applies play/pause/seek locally * - Auto-reconnects on unexpected close */ export declare class CollaborativeClient { private ws; private options; private unsubscribes; private reconnectTimer; private disposed; private lastPlaybackSend; private connected; constructor(options: CollabClientOptions); /** Connect to the collaborative server */ connect(): void; /** Whether the client is currently connected */ isConnected(): boolean; /** Gracefully disconnect and clean up */ dispose(): void; private handleMessage; private handleRoomState; private handleSync; private applySync; /** Host: subscribe to local state changes and broadcast them */ private subscribeHostState; /** Throttled playback state sender */ private sendPlaybackState; /** Send a chat message */ sendChat(text: string): void; /** Send a voice signal (SDP offer/answer or ICE candidate) to a specific peer */ sendVoiceSignal(targetUserId: string, sdp?: string, candidate?: string): void; /** Send a message to the server */ send(msg: ClientMessage): void; private scheduleReconnect; /** Register a cleanup function to run on dispose */ addCleanup(fn: () => void): void; private cleanupSubscriptions; } //# sourceMappingURL=collab-client.d.ts.map