// Typescript file for core.rtcpeerconnection in: // https://github.com/freedomjs/freedom/blob/master/interface/core.rtcpeerconnection.json /// declare module freedom_RTCPeerConnection { interface RTCIceServer { urls :string[]; username ?:string; credential ?:string; } interface RTCConfiguration { iceServers :RTCIceServer[]; iceTransports ?:string; peerIdentity ?:string; } interface RTCOfferOptions { offerToReceiveVideo ?:number; offerToReceiveAudio ?:number; voiceActivityDetection ?:boolean; iceRestart ?:boolean; } interface RTCSessionDescription { type :string; sdp :string; } interface RTCIceCandidate { candidate :string; sdpMid ?:string; sdpMLineIndex ?:number; } interface OnIceCandidateEvent { candidate :RTCIceCandidate } interface RTCDataChannelInit { ordered ?:boolean; maxPacketLifeTime ?:number; maxRetransmits ?:number; protocol ?:string; negotiated ?:boolean; id ?:number; } // Note: the freedom factory constructor // |freedom['rtcpeerconnection'](config)| to create an RTCPeerConnection has // |RTCConfiguration| as the type of its config its argument. interface RTCPeerConnection { createOffer(options?:RTCOfferOptions) : Promise; createAnswer() : Promise; setLocalDescription(desc:RTCSessionDescription) : Promise; getLocalDescription() : Promise; setRemoteDescription(desc:RTCSessionDescription) : Promise; getRemoteDescription() : Promise; getSignalingState() : Promise; updateIce(configuration:RTCConfiguration) : Promise; addIceCandidate(candidate:RTCIceCandidate) : Promise; getIceGatheringState() : Promise; getIceConnectionState() : Promise; getConfiguration() : Promise; getLocalStreams() : Promise; getRemoteStreams() : Promise; getStreamById(id:string) : Promise; addStream(ref:string) : Promise; removeStream(ref:string) : Promise; close() : Promise; createDataChannel(label:string, init:RTCDataChannelInit) : Promise; getStats(selector?:string) : Promise; on(t:'ondatachannel', f:(d:{channel:string}) => void) : void; on(t:'onnegotiationneeded', f:() => void) : void; on(t:'onicecandidate', f:(d:OnIceCandidateEvent) => void) : void; on(t:'onsignalingstatechange', f:() => void) : void; on(t:'onaddstream', f:(d:{stream:number}) => void) : void; on(t:'onremovestream', f:(d:{stream:number}) => void) : void; on(t:'oniceconnectionstatechange', f:() => void) : void; on(t:string, f:Function) : void; } }