diff --git a/webrtc/MediaStream.d.ts b/webrtc/MediaStream.d.ts index 23aee0987d..734c27031f 100644 --- a/webrtc/MediaStream.d.ts +++ b/webrtc/MediaStream.d.ts @@ -1,42 +1,42 @@ // Type definitions take from http://dev.w3.org/2011/webrtc/editor/getusermedia.html interface MediaStreamConstraints { - audio: bool; - video: bool; + audio: bool; + video: bool; } declare var MediaStreamConstraints: { - prototype: MediaStreamConstraints; - new (): MediaStreamConstraints; + prototype: MediaStreamConstraints; + new (): MediaStreamConstraints; } interface MediaTrackConstraints { - mandatory: MediaTrackConstraintSet; - optional: MediaTrackConstraint[]; + mandatory: MediaTrackConstraintSet; + optional: MediaTrackConstraint[]; } declare var MediaTrackConstraints: { - prototype: MediaTrackConstraints; - new (): MediaTrackConstraints; + prototype: MediaTrackConstraints; + new (): MediaTrackConstraints; } // ks - Not defined in the source doc. interface MediaTrackConstraintSet { } declare var MediaTrackConstraintSet: { - prototype: MediaTrackConstraintSet; - new (): MediaTrackConstraintSet; + prototype: MediaTrackConstraintSet; + new (): MediaTrackConstraintSet; } // ks - Not defined in the source doc. interface MediaTrackConstraint { } declare var MediaTrackConstraint: { - prototype: MediaTrackConstraint; - new (): MediaTrackConstraints; + prototype: MediaTrackConstraint; + new (): MediaTrackConstraints; } interface Navigator { - getUserMedia(constraints: MediaStreamConstraints, successCallback: (stream: LocalMediaStream) => void , errorCallback: (error: Error) => void ); - webkitGetUserMedia(constraints: MediaStreamConstraints, successCallback: (stream: LocalMediaStream) => void , errorCallback: (error: Error) => void ); + getUserMedia(constraints: MediaStreamConstraints, successCallback: (stream: any) => void , errorCallback: (error: Error) => void ); + webkitGetUserMedia(constraints: MediaStreamConstraints, successCallback: (stream: any) => void , errorCallback: (error: Error) => void ); } interface EventHandler { (event: Event): void; } @@ -44,93 +44,93 @@ interface EventHandler { (event: Event): void; } interface NavigatorUserMediaSuccessCallback { (stream: LocalMediaStream): void; } interface NavigatorUserMediaError { - PERMISSION_DENIED: number; // = 1; - code: number; + PERMISSION_DENIED: number; // = 1; + code: number; } declare var NavigatorUserMediaError: { - prototype: NavigatorUserMediaError; - new (): NavigatorUserMediaError; - PERMISSION_DENIED: number; // = 1; + prototype: NavigatorUserMediaError; + new (): NavigatorUserMediaError; + PERMISSION_DENIED: number; // = 1; } interface NavigatorUserMediaErrorCallback { (error: NavigatorUserMediaError): void; } interface MediaStreamTrackList { - length: number; - item: MediaStreamTrack; - add(track: MediaStreamTrack): void; - remove(track: MediaStreamTrack): void; - onaddtrack: (event: Event) => void; - onremovetrack: (event: Event) => void; + length: number; + item: MediaStreamTrack; + add(track: MediaStreamTrack): void; + remove(track: MediaStreamTrack): void; + onaddtrack: (event: Event) => void; + onremovetrack: (event: Event) => void; } declare var MediaStreamTrackList: { - prototype: MediaStreamTrackList; - new (): MediaStreamTrackList; + prototype: MediaStreamTrackList; + new (): MediaStreamTrackList; } declare var webkitMediaStreamTrackList: { - prototype: MediaStreamTrackList; - new (): MediaStreamTrackList; + prototype: MediaStreamTrackList; + new (): MediaStreamTrackList; } interface MediaStream { - label: string; - audioTracks: MediaStreamTrackList; - videoTracks: MediaStreamTrackList; - ended: bool; - onended: (event: Event) => void; + label: string; + getAudioTracks(): MediaStreamTrackList; + getVideoTracks(): MediaStreamTrackList; + ended: bool; + onended: (event: Event) => void; } declare var MediaStream: { - prototype: MediaStream; - new (): MediaStream; - new (trackContainers: MediaStream[]): MediaStream; - new (trackContainers: MediaStreamTrackList[]): MediaStream; - new (trackContainers: MediaStreamTrack[]): MediaStream; + prototype: MediaStream; + new (): MediaStream; + new (trackContainers: MediaStream[]): MediaStream; + new (trackContainers: MediaStreamTrackList[]): MediaStream; + new (trackContainers: MediaStreamTrack[]): MediaStream; } declare var webkitMediaStream: { - prototype: MediaStream; - new (): MediaStream; - new (trackContainers: MediaStream[]): MediaStream; - new (trackContainers: MediaStreamTrackList[]): MediaStream; - new (trackContainers: MediaStreamTrack[]): MediaStream; + prototype: MediaStream; + new (): MediaStream; + new (trackContainers: MediaStream[]): MediaStream; + new (trackContainers: MediaStreamTrackList[]): MediaStream; + new (trackContainers: MediaStreamTrack[]): MediaStream; } interface LocalMediaStream extends MediaStream { - stop(): void; + stop(): void; } interface MediaStreamTrack { - kind: string; - label: string; - enabled: bool; - LIVE: number; // = 0; - MUTED: number; // = 1; - ENDED: number; // = 2; - readyState: number; - onmute: (event: Event) => void; - onunmute: (event: Event) => void; - onended: (event: Event) => void; + kind: string; + label: string; + enabled: bool; + LIVE: number; // = 0; + MUTED: number; // = 1; + ENDED: number; // = 2; + readyState: number; + onmute: (event: Event) => void; + onunmute: (event: Event) => void; + onended: (event: Event) => void; } var MediaStramTrack: { - prototype: MediaStreamTrack; - new (): MediaStreamTrack; - LIVE: number; // = 0; - MUTED: number; // = 1; - ENDED: number; // = 2; + prototype: MediaStreamTrack; + new (): MediaStreamTrack; + LIVE: number; // = 0; + MUTED: number; // = 1; + ENDED: number; // = 2; } interface URL { - createObjectURL(stream: MediaStream): string; + createObjectURL(stream: MediaStream): string; } var URL: { - prototype: MediaStreamTrack; - new (): URL; - createObjectURL(stream: MediaStream): string; + prototype: MediaStreamTrack; + new (): URL; + createObjectURL(stream: MediaStream): string; } interface WebkitURL extends URL { } var webkitURL: { - prototype: WebkitURL; - new (): URL; - createObjectURL(stream: MediaStream): string; -} + prototype: WebkitURL; + new (): URL; + createObjectURL(stream: MediaStream): string; +} \ No newline at end of file diff --git a/webrtc/RTCPeerConnection.d.ts b/webrtc/RTCPeerConnection.d.ts index 7276b60aa7..d1bc47fcf8 100644 --- a/webrtc/RTCPeerConnection.d.ts +++ b/webrtc/RTCPeerConnection.d.ts @@ -3,63 +3,66 @@ // These are TypeScript definitions to support static typing in TypeScript when interacting with WebRtc. // Definitions taken from http://dev.w3.org/2011/webrtc/editor/webrtc.html +// These are TypeScript definitions to support static typing in TypeScript when interacting with WebRtc. +// Definitions taken from http://dev.w3.org/2011/webrtc/editor/webrtc.html + interface RTCConfiguration { - iceServers: RTCIceServer[]; + iceServers: RTCIceServer[]; } var RTCConfiguration: { - prototype: RTCConfiguration; - new (): RTCConfiguration; + prototype: RTCConfiguration; + new (): RTCConfiguration; } interface RTCIceServer { - url: string; - credential?: string; + url: string; + credential?: string; } var RTCIceServer: { - prototype: RTCIceServer; - new (): RTCIceServer; + prototype: RTCIceServer; + new (): RTCIceServer; } interface webkitRTCPeerConnection extends RTCPeerConnection { } var webkitRTCPeerConnection: { - prototype: webkitRTCPeerConnection; - new (settings: RTCPeerConnectionConfig, constraints?:MediaConstraints): webkitRTCPeerConnection; + prototype: webkitRTCPeerConnection; + new (settings: RTCPeerConnectionConfig, constraints?:MediaConstraints): webkitRTCPeerConnection; } interface IceState { } var IceState: { - prototype: IceState; - new (): IceState; + prototype: IceState; + new (): IceState; } // ks 12/20/12 - There's more here that doesn't seem to be documented very well yet. interface MediaConstraints { - mandatory: MediaOfferConstraints; + mandatory: MediaOfferConstraints; } interface MediaOfferConstraints { - OfferToReceiveAudio: bool; - OfferToReceiveVideo: bool; + OfferToReceiveAudio: bool; + OfferToReceiveVideo: bool; } interface RTCSessionDescription { - type?: RTCSdpType; - sdp?: string; + type?: RTCSdpType; + sdp?: string; } var RTCSessionDescription: { - prototype: RTCSessionDescription; - new (descriptionInitDict?: RTCSessionDescriptionInit): RTCSessionDescription; + prototype: RTCSessionDescription; + new (descriptionInitDict?: RTCSessionDescriptionInit): RTCSessionDescription; } interface RTCSessionDescriptionInit { - type: RTCSdpType; - sdp: string; + type: RTCSdpType; + sdp: string; } var RTCSessionDescriptionInit: { - prototype: RTCSessionDescriptionInit; - new (): RTCSessionDescriptionInit; + prototype: RTCSessionDescriptionInit; + new (): RTCSessionDescriptionInit; } interface SdpType { @@ -69,153 +72,158 @@ interface RTCPeerState { } interface RTCDataChannelInit { - reliable: bool; + reliable: bool; } enum RTCSdpType { - offer, - pranswer, - answer + offer, + pranswer, + answer } enum RTCDataChannelState { - connecting, - open, - closing, - closed + connecting, + open, + closing, + closed } interface RTCDataChannel extends EventTarget { - label: string; - reliable: bool; - readyState: RTCDataChannelState; - bufferedAmount: number; - onopen: (event: Event)=> void; - onerror: (event: Event)=> void; - onclose: (event: Event)=> void; - close(): void; - onmessage: (event: Event)=> void; - binaryType: string; - send(data: string); - send(data: ArrayBuffer); - send(data: Blob); + label: string; + reliable: bool; + readyState: RTCDataChannelState; + bufferedAmount: number; + onopen: (event: Event)=> void; + onerror: (event: Event)=> void; + onclose: (event: Event)=> void; + close(): void; + onmessage: (event: Event)=> void; + binaryType: string; + send(data: string); + send(data: ArrayBuffer); + send(data: Blob); } declare var RTCDataChannel: { - prototype: RTCDataChannel; - new (): RTCDataChannel; + prototype: RTCDataChannel; + new (): RTCDataChannel; } interface RTCDataChannelEvent extends Event { - constructor (eventInitDict: RTCDataChannelEventInit); - channel: RTCDataChannel; + constructor (eventInitDict: RTCDataChannelEventInit); + channel: RTCDataChannel; } var RTCDataChannelEvent: { - prototype: RTCDataChannelEvent; - new (eventInitDict: RTCDataChannelEventInit); + prototype: RTCDataChannelEvent; + new (eventInitDict: RTCDataChannelEventInit); } interface RTCIceCandidateEvent extends Event{ - candidate: RTCIceCandidate; + candidate: RTCIceCandidate; } interface RTCMediaStreamEvent extends Event { - stream: MediaStream; + stream: MediaStream; } interface EventInit { } interface RTCDataChannelEventInit extends EventInit { - channel: RTCDataChannel; + channel: RTCDataChannel; } interface RTCVoidCallback { - (): void; + (): void; } interface RTCSessionDescriptionCallback { - (sdp: RTCSessionDescription): void; + (sdp: RTCSessionDescription): void; } interface RTCPeerConnectionErrorCallback { - (errorInformation: string): void; + (errorInformation: string): void; } -// This should be an enum -interface RTCGatheringState { - string; +/** This should be an enum */ +interface RTCIceGatheringState { + string; } -// This should be an enum -interface RTCIceState { - string; +/** This should be an enum */ +interface RTCIceConnectionState { + string; +} + +/** This should be an enum */ +interface RTCSignalingState{ + string; } interface RTCPeerConnection { - createOffer(successCallback: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, constraints?: MediaConstraints): void; - createAnswer(successCallback: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, constraints?: MediaConstraints): void; - setLocalDescription(description: RTCSessionDescription, successCallback?: RTCVoidCallback, failureCallback?: RTCPeerConnectionErrorCallback): void; - localDescription: RTCSessionDescription; - setRemoteDescription(description: RTCSessionDescription, successCallback?: RTCVoidCallback, failureCallback?: RTCPeerConnectionErrorCallback): void; - remoteDescription: RTCSessionDescription; - readyState: RTCPeerState; - updateIce(configuration?: RTCConfiguration, constraints?: MediaConstraints): void; - addIceCandidate(candidate: RTCIceCandidate): void; - iceGatheringState: RTCGatheringState; - iceState: RTCIceState; - localStreams: MediaStream[]; - remoteStreams: MediaStream[]; - createDataChannel(label?: string, dataChannelDict?: RTCDataChannelInit): RTCDataChannel; - ondatachannel: (event: Event)=> void; - addStream(stream: MediaStream, constraints?: MediaConstraints): void; - removeStream(stream: MediaStream): void; - close(): void; - onnegotiationneeded: (event: Event)=> void; - onconnecting: (event: Event)=> void; - onopen: (event: Event)=> void; - onaddstream: (event: RTCMediaStreamEvent)=> void; - onremovestream: (event: RTCMediaStreamEvent)=> void; - onstatechange: (event: Event)=> void; - onicechange: (event: Event)=> void; - onicecandidate: (event: RTCIceCandidateEvent)=> void; - onidentityresult: (event: Event)=> void; + createOffer(successCallback: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, constraints?: MediaConstraints): void; + createAnswer(successCallback: RTCSessionDescriptionCallback, failureCallback?: RTCPeerConnectionErrorCallback, constraints?: MediaConstraints): void; + setLocalDescription(description: RTCSessionDescription, successCallback?: RTCVoidCallback, failureCallback?: RTCPeerConnectionErrorCallback): void; + localDescription: RTCSessionDescription; + setRemoteDescription(description: RTCSessionDescription, successCallback?: RTCVoidCallback, failureCallback?: RTCPeerConnectionErrorCallback): void; + remoteDescription: RTCSessionDescription; + signalingState: RTCSignalingState; + updateIce(configuration?: RTCConfiguration, constraints?: MediaConstraints): void; + addIceCandidate(candidate: RTCIceCandidate): void; + iceGatheringState: RTCIceGatheringState; + iceConnectionState: RTCIceConnectionState; + getLocalStreams(): MediaStream[]; + getRemoteStreams(): MediaStream[]; + createDataChannel(label?: string, dataChannelDict?: RTCDataChannelInit): RTCDataChannel; + ondatachannel: (event: Event)=> void; + addStream(stream: MediaStream, constraints?: MediaConstraints): void; + removeStream(stream: MediaStream): void; + close(): void; + onnegotiationneeded: (event: Event)=> void; + onconnecting: (event: Event)=> void; + onopen: (event: Event)=> void; + onaddstream: (event: RTCMediaStreamEvent)=> void; + onremovestream: (event: RTCMediaStreamEvent)=> void; + onstatechange: (event: Event)=> void; + onicechange: (event: Event)=> void; + onicecandidate: (event: RTCIceCandidateEvent)=> void; + onidentityresult: (event: Event)=> void; } var RTCPeerConnection: { - prototype: RTCPeerConnection; - new (configuration: RTCConfiguration, constraints?: MediaConstraints): RTCPeerConnection; + prototype: RTCPeerConnection; + new (configuration: RTCConfiguration, constraints?: MediaConstraints): RTCPeerConnection; } interface RTCIceCandidate { - candidate?: string; - sdpMid?: string; - sdpMLineIndex?: number; + candidate?: string; + sdpMid?: string; + sdpMLineIndex?: number; } var RTCIceCandidate: { - prototype: RTCIceCandidate; - new (candidateInitDict?: RTCIceCandidate); + prototype: RTCIceCandidate; + new (candidateInitDict?: RTCIceCandidate); } interface RTCIceCandidateInit { - candidate: string; - sdpMid: string; - sdpMLineIndex: number; + candidate: string; + sdpMid: string; + sdpMLineIndex: number; } var RTCIceCandidateInit:{ - prototype: RTCIceCandidateInit; - new (): RTCIceCandidateInit; + prototype: RTCIceCandidateInit; + new (): RTCIceCandidateInit; } interface PeerConnectionIceEvent { - peer: RTCPeerConnection; - candidate: RTCIceCandidate; + peer: RTCPeerConnection; + candidate: RTCIceCandidate; } var PeerConnectionIceEvent: { - prototype: PeerConnectionIceEvent; - new (): PeerConnectionIceEvent; + prototype: PeerConnectionIceEvent; + new (): PeerConnectionIceEvent; } interface RTCPeerConnectionConfig { - iceServers: RTCIceServer[]; + iceServers: RTCIceServer[]; } var RTCPeerConnectionConfig: { - prototype: RTCPeerConnectionConfig; - new (): RTCPeerConnectionConfig; + prototype: RTCPeerConnectionConfig; + new (): RTCPeerConnectionConfig; }