/** * WebRTC Manager for SmartCamera * * This class provides utilities for managing WebRTC peer connections, * media streams, and video calling functionality. * * Requires react-native-webrtc to be installed in the app. */ import type { PeerConnectionConfig, MediaConstraints, SessionDescription, ICECandidateEvent, WebRTCConnectionState, ICEConnectionState } from './types'; /** * Check if WebRTC is available */ export declare function isWebRTCAvailable(): boolean; /** * WebRTC Manager class for handling peer connections and media streams */ export declare class WebRTCManager { private peerConnection; private localStream; private remoteStream; private config; private iceCandidateCallback; private remoteStreamCallback; private connectionStateCallback; private iceConnectionStateCallback; constructor(config?: PeerConnectionConfig); /** * Get local media stream (camera + microphone) * * @param constraints - Media constraints for video/audio * @returns Promise resolving to MediaStream */ getLocalStream(constraints?: MediaConstraints): Promise; /** * Stop the local media stream */ stopLocalStream(): void; /** * Get the current local stream */ getLocalStreamInstance(): MediaStream | null; /** * Switch between front and back camera */ switchCamera(): Promise; /** * Toggle video track on/off * * @param enabled - Whether video should be enabled */ toggleVideo(enabled: boolean): void; /** * Toggle audio track on/off * * @param enabled - Whether audio should be enabled */ toggleAudio(enabled: boolean): void; /** * Create a new peer connection * * @param config - Optional peer connection configuration * @returns The created RTCPeerConnection */ createPeerConnection(config?: PeerConnectionConfig): RTCPeerConnection; /** * Get the current peer connection */ getPeerConnection(): RTCPeerConnection | null; /** * Close the peer connection */ closePeerConnection(): void; /** * Setup listeners for peer connection events */ private setupPeerConnectionListeners; /** * Add local stream to peer connection * * @param stream - The local MediaStream to add */ addLocalStream(stream: MediaStream): void; /** * Get the remote stream */ getRemoteStream(): MediaStream | null; /** * Create an SDP offer * * @returns Promise resolving to SessionDescription */ createOffer(): Promise; /** * Create an SDP answer * * @returns Promise resolving to SessionDescription */ createAnswer(): Promise; /** * Set the remote SDP description * * @param description - The remote SessionDescription */ setRemoteDescription(description: SessionDescription): Promise; /** * Add an ICE candidate from remote peer * * @param candidate - The ICE candidate to add */ addIceCandidate(candidate: RTCIceCandidate): Promise; /** * Register callback for ICE candidates * * @param callback - Function to call when ICE candidate is generated */ onIceCandidate(callback: (event: ICECandidateEvent) => void): void; /** * Register callback for remote stream * * @param callback - Function to call when remote stream is received */ onRemoteStream(callback: (stream: MediaStream) => void): void; /** * Register callback for connection state changes * * @param callback - Function to call when connection state changes */ onConnectionStateChange(callback: (state: WebRTCConnectionState) => void): void; /** * Register callback for ICE connection state changes * * @param callback - Function to call when ICE connection state changes */ onIceConnectionStateChange(callback: (state: ICEConnectionState) => void): void; /** * Clean up all resources */ cleanup(): void; } /** * Get the shared WebRTC manager instance */ export declare function getWebRTCManager(config?: PeerConnectionConfig): WebRTCManager; /** * Create a new WebRTC manager instance */ export declare function createWebRTCManager(config?: PeerConnectionConfig): WebRTCManager; //# sourceMappingURL=WebRTCManager.d.ts.map