import { RTCConnectionConfig, RTCPrepareConnectionConfig } from '../types'; /** * RTC Provider interface. * * This interface defines the contract that all RTC providers * (LiveKit, Agora, etc.) must implement. Applications typically * don't interact with this interface directly - use AvatarPlayer instead. * * @example * ```typescript * // For most use cases, use AvatarPlayer: * const player = new AvatarPlayer(new LiveKitProvider(), renderer); * * // Only implement RTCProvider for custom providers: * class MyCustomProvider implements RTCProvider { * // ...implementation * } * ``` */ export type RTCProviderEventHandler = (...args: unknown[]) => void; export interface RTCProvider { /** * Provider name identifier (e.g., 'livekit', 'agora'). * Used for logging and debugging. */ readonly name: string; /** * Pre-warm a future connection if the provider supports it. * This should not establish a full RTC session or change connection state, * but may warm DNS/TLS caches or select an edge region. */ prepareConnection?(config: RTCPrepareConnectionConfig): Promise; /** * Connect to RTC server. * @param config - Connection configuration containing server URL and credentials * @throws Error if connection fails */ connect(config: RTCConnectionConfig): Promise; /** * Disconnect from RTC server. * Cleans up all resources and stops all tracks. */ disconnect(): Promise; /** * Get current connection state. * @returns Current connection state string */ getConnectionState(): string; /** * Publish local audio track (microphone) to the RTC server. * @param track - Optional MediaStreamTrack from getUserMedia; when omitted the provider may create a microphone track */ publishAudioTrack(track?: MediaStreamTrack): Promise; /** * Unpublish audio track from the RTC server. */ unpublishAudioTrack(): Promise; /** * Add event listener. * @param event - Event name * @param handler - Event handler function */ on(event: string, handler: RTCProviderEventHandler): void; /** * Remove event listener. * @param event - Event name * @param handler - Event handler function */ off(event: string, handler: RTCProviderEventHandler): void; /** * Get the native RTC client object. * * For LiveKit: returns the Room instance * For Agora: returns the IAgoraRTCClient instance * * @returns The native RTC client object, or null if not connected */ getNativeClient(): unknown; } //# sourceMappingURL=RTCProvider.d.ts.map