@webrtc2/client
Version:
WebRTC2 Client - React Native, Web & Electron WebRTC hooks and components for cross-platform real-time video calls, audio communication, and screen sharing
46 lines (40 loc) • 911 B
text/typescript
/**
* WebRTC2 Client Types
*/
export interface WebRTCConfig {
iceServers: RTCIceServer[];
signaling: {
url: string;
options?: any;
};
}
export type ConnectionState =
| 'disconnected'
| 'connecting'
| 'connected'
| 'failed'
| 'closed';
export interface MediaStreamOptions {
video?: boolean | MediaTrackConstraints;
audio?: boolean | MediaTrackConstraints;
screen?: boolean;
}
export interface PeerConnection {
id: string;
connection: RTCPeerConnection;
stream?: MediaStream;
}
export type CallState =
| 'idle'
| 'calling'
| 'ringing'
| 'connected'
| 'ended';
export interface WebRTCHookReturn {
connect: (roomId: string) => Promise<void>;
disconnect: () => void;
localStream: MediaStream | null;
remoteStream: MediaStream | null;
connectionState: ConnectionState;
callState: CallState;
}