UNPKG

multipeer

Version:

A javascript library that implemets the essential functionalities of WebRTC to make it easier to implement a multiple peer connections typically needed for a video conferencing application.

33 lines (32 loc) 1.37 kB
export declare enum RTCEventType { NEW_ICE_CANDIDATE = "NEW_ICE_CANDIDATE", VIDEO_OFFER = "VIDEO_OFFER", VIDEO_ANSWER = "VIDEO_ANSWER", NEW_TRACK = "NEW_TRACK" } export interface RTCEvent { id: string; event: string; [key: string]: any; } export declare class Multipeer { private _allPeerConnections; private _rtcPeerConfig; private _localStream; private _remoteStream; private _signalFunction; private _defaultMediaStreamConstraints; /** * @param {RTCConfiguration} config - RTCConfiguration object with ICE Server config etc. * @param {Function} signalFunction - a callback function which will be called every time an RTC event occurs. An object of type RTCEvent is passed to this signal function. * @param {MediaStreamConstraints=} mediaStreamConstraints <optional> - MediaStreamConstraints if any */ constructor(config: RTCConfiguration, signalFunction: Function, mediaStreamConstraints?: MediaStreamConstraints); private initializeLocalStream; createPeerConnection: (id: string) => void; private handleICECandidateEvent; private handleTrackEvent; createNewOffer: (id: string) => void; handleVideoOffer: (id: string, sdp: RTCSessionDescription) => void; handleVideoAnswer: (id: string, sdp: RTCSessionDescription) => void; }