made RTC prefix standard for all interfaces

This commit is contained in:
Lucas Dixon
2014-07-04 18:13:39 -04:00
parent df6f0353d0
commit d0cbf02b26
2 changed files with 25 additions and 18 deletions

View File

@@ -1,10 +1,13 @@
/// <reference path="MediaStream.d.ts" />
/// <reference path="RTCPeerConnection.d.ts" />
var config: RTCConfiguration = { iceServers: [{ url: "stun.l.google.com:19302" }] };
var constraints: MediaConstraints = { mandatory: { OfferToReceiveAudio: true, OfferToReceiveVideo: true } };
var config: RTCConfiguration =
{ iceServers: [{ url: "stun.l.google.com:19302" }] };
var constraints: RTCMediaConstraints =
{ mandatory: { OfferToReceiveAudio: true, OfferToReceiveVideo: true } };
var peerConnection: RTCPeerConnection = new RTCPeerConnection(config, constraints);
var peerConnection: RTCPeerConnection =
new RTCPeerConnection(config, constraints);
navigator.getUserMedia({ audio: true, video: true },
stream => {
@@ -41,11 +44,15 @@ peerConnection.setRemoteDescription(sessionDescription, () => {
answer => {
peerConnection.setLocalDescription(answer,
() => console.log('Set local description'),
error => console.log("Error setting local description from created answer: " + error + "; answer.sdp=" + answer.sdp));
error => console.log(
"Error setting local description from created answer: " + error +
"; answer.sdp=" + answer.sdp));
},
error => console.log("Error creating answer: " + error));
},
error => console.log('Error setting remote description: ' + error + "; offer.sdp=" + offer.sdp));
error => console.log('Error setting remote description: ' + error +
"; offer.sdp=" + offer.sdp));
var wkPeerConnection: webkitRTCPeerConnection = new webkitRTCPeerConnection(config, constraints);
var wkPeerConnection: webkitRTCPeerConnection =
new webkitRTCPeerConnection(config, constraints);

View File

@@ -43,7 +43,7 @@ interface mozRTCPeerConnection extends RTCPeerConnection {
declare var mozRTCPeerConnection: {
prototype: mozRTCPeerConnection;
new (settings: RTCPeerConnectionConfig,
constraints?:MediaConstraints): mozRTCPeerConnection;
constraints?:RTCMediaConstraints): mozRTCPeerConnection;
}
// webkit (Chrome) specific prefixes.
interface webkitRTCPeerConnection extends RTCPeerConnection {
@@ -51,12 +51,12 @@ interface webkitRTCPeerConnection extends RTCPeerConnection {
declare var webkitRTCPeerConnection: {
prototype: webkitRTCPeerConnection;
new (settings: RTCPeerConnectionConfig,
constraints?:MediaConstraints): webkitRTCPeerConnection;
constraints?:RTCMediaConstraints): webkitRTCPeerConnection;
}
// For Chrome, look at the code here:
// https://code.google.com/p/chromium/codesearch#chromium/src/third_party/libjingle/source/talk/app/webrtc/webrtcsession.cc&sq=package:chromium&dr=C&l=63
interface OptionalMediaConstraint {
interface RTCOptionalMediaConstraint {
// When true, will use DTLS/SCTP data channels
DtlsSrtpKeyAgreement?: boolean;
// When true will use Rtp-based data channels (depreicated)
@@ -65,12 +65,12 @@ interface OptionalMediaConstraint {
// ks 12/20/12 - There's more here that doesn't seem to be documented very well yet.
// http://www.w3.org/TR/2013/WD-webrtc-20130910/
interface MediaConstraints {
mandatory?: MediaOfferConstraints;
optional?: OptionalMediaConstraint[]
interface RTCMediaConstraints {
mandatory?: RTCMediaOfferConstraints;
optional?: RTCOptionalMediaConstraint[]
}
interface MediaOfferConstraints {
interface RTCMediaOfferConstraints {
OfferToReceiveAudio: boolean;
OfferToReceiveVideo: boolean;
}
@@ -215,10 +215,10 @@ declare enum RTCSignalingState {
interface RTCPeerConnection {
createOffer(successCallback: RTCSessionDescriptionCallback,
failureCallback?: RTCPeerConnectionErrorCallback,
constraints?: MediaConstraints): void;
constraints?: RTCMediaConstraints): void;
createAnswer(successCallback: RTCSessionDescriptionCallback,
failureCallback?: RTCPeerConnectionErrorCallback,
constraints?: MediaConstraints): void;
constraints?: RTCMediaConstraints): void;
setLocalDescription(description: RTCSessionDescription,
successCallback?: RTCVoidCallback,
failureCallback?: RTCPeerConnectionErrorCallback): void;
@@ -229,7 +229,7 @@ interface RTCPeerConnection {
remoteDescription: RTCSessionDescription;
signalingState: string; // RTCSignalingState; see TODO(1)
updateIce(configuration?: RTCConfiguration,
constraints?: MediaConstraints): void;
constraints?: RTCMediaConstraints): void;
addIceCandidate(candidate: RTCIceCandidate): void;
iceGatheringState: string; // RTCIceGatheringState; see TODO(1)
iceConnectionState: string; // RTCIceConnectionState; see TODO(1)
@@ -238,7 +238,7 @@ interface RTCPeerConnection {
createDataChannel(label?: string,
dataChannelDict?: RTCDataChannelInit): RTCDataChannel;
ondatachannel: (event: Event) => void;
addStream(stream: MediaStream, constraints?: MediaConstraints): void;
addStream(stream: MediaStream, constraints?: RTCMediaConstraints): void;
removeStream(stream: MediaStream): void;
close(): void;
onnegotiationneeded: (event: Event) => void;
@@ -255,7 +255,7 @@ interface RTCPeerConnection {
declare var RTCPeerConnection: {
prototype: RTCPeerConnection;
new (configuration: RTCConfiguration,
constraints?: MediaConstraints): RTCPeerConnection;
constraints?: RTCMediaConstraints): RTCPeerConnection;
}
interface RTCIceCandidate {