UNPKG

@webrtc2/types

Version:

WebRTC2 Types - Comprehensive TypeScript definitions for WebRTC cross-platform development including React Native, Web, and Electron type definitions

75 lines (65 loc) 1.52 kB
/** * @webrtc2/types * * Core TypeScript type definitions for WebRTC2 ecosystem */ // WebRTC Connection Types export interface RTCConnectionConfig { iceServers: RTCIceServer[]; iceTransportPolicy?: RTCIceTransportPolicy; bundlePolicy?: RTCBundlePolicy; } export type ConnectionState = | 'new' | 'connecting' | 'connected' | 'disconnected' | 'failed' | 'closed'; // Media Types export interface MediaDeviceInfo { deviceId: string; kind: 'audioinput' | 'audiooutput' | 'videoinput'; label: string; groupId: string; } export interface MediaStreamConstraints { video?: boolean | MediaTrackConstraints; audio?: boolean | MediaTrackConstraints; } // Signaling Types export interface SignalingMessage { type: 'offer' | 'answer' | 'ice-candidate' | 'join' | 'leave'; payload: any; from: string; to: string; timestamp: number; } // Room and Session Types export interface Room { id: string; name: string; participants: Participant[]; createdAt: Date; settings: RoomSettings; } export interface Participant { id: string; name: string; isHost: boolean; stream?: MediaStream; connectionState: ConnectionState; } export interface RoomSettings { maxParticipants: number; requiresPassword: boolean; allowScreenShare: boolean; allowRecording: boolean; } // Event Types export interface WebRTCEvent { type: string; data: any; timestamp: number; } export const VERSION = '1.0.0';