@webrtc2/types
Version:
WebRTC2 Types - Comprehensive TypeScript definitions for WebRTC cross-platform development including React Native, Web, and Electron type definitions
57 lines (55 loc) • 1.53 kB
text/typescript
/**
* @webrtc2/types
*
* Core TypeScript type definitions for WebRTC2 ecosystem
*/
interface RTCConnectionConfig {
iceServers: RTCIceServer[];
iceTransportPolicy?: RTCIceTransportPolicy;
bundlePolicy?: RTCBundlePolicy;
}
type ConnectionState = 'new' | 'connecting' | 'connected' | 'disconnected' | 'failed' | 'closed';
interface MediaDeviceInfo {
deviceId: string;
kind: 'audioinput' | 'audiooutput' | 'videoinput';
label: string;
groupId: string;
}
interface MediaStreamConstraints {
video?: boolean | MediaTrackConstraints;
audio?: boolean | MediaTrackConstraints;
}
interface SignalingMessage {
type: 'offer' | 'answer' | 'ice-candidate' | 'join' | 'leave';
payload: any;
from: string;
to: string;
timestamp: number;
}
interface Room {
id: string;
name: string;
participants: Participant[];
createdAt: Date;
settings: RoomSettings;
}
interface Participant {
id: string;
name: string;
isHost: boolean;
stream?: MediaStream;
connectionState: ConnectionState;
}
interface RoomSettings {
maxParticipants: number;
requiresPassword: boolean;
allowScreenShare: boolean;
allowRecording: boolean;
}
interface WebRTCEvent {
type: string;
data: any;
timestamp: number;
}
declare const VERSION = "1.0.0";
export { type ConnectionState, type MediaDeviceInfo, type MediaStreamConstraints, type Participant, type RTCConnectionConfig, type Room, type RoomSettings, type SignalingMessage, VERSION, type WebRTCEvent };