|
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
4 * You can obtain one at http://mozilla.org/MPL/2.0/. |
|
5 * |
|
6 * The origin of this IDL file is |
|
7 * http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCPeerConnection |
|
8 */ |
|
9 |
|
10 callback RTCSessionDescriptionCallback = void (mozRTCSessionDescription sdp); |
|
11 callback RTCPeerConnectionErrorCallback = void (DOMString errorInformation); |
|
12 callback VoidFunction = void (); |
|
13 callback RTCStatsCallback = void (RTCStatsReport report); |
|
14 |
|
15 enum RTCSignalingState { |
|
16 "stable", |
|
17 "have-local-offer", |
|
18 "have-remote-offer", |
|
19 "have-local-pranswer", |
|
20 "have-remote-pranswer", |
|
21 "closed" |
|
22 }; |
|
23 |
|
24 enum RTCIceGatheringState { |
|
25 "new", |
|
26 "gathering", |
|
27 "complete" |
|
28 }; |
|
29 |
|
30 enum RTCIceConnectionState { |
|
31 "new", |
|
32 "checking", |
|
33 "connected", |
|
34 "completed", |
|
35 "failed", |
|
36 "disconnected", |
|
37 "closed" |
|
38 }; |
|
39 |
|
40 dictionary RTCDataChannelInit { |
|
41 boolean ordered = true; |
|
42 unsigned short? maxRetransmitTime = null; |
|
43 unsigned short? maxRetransmits = null; |
|
44 DOMString protocol = ""; |
|
45 boolean negotiated = false; // spec currently says 'true'; we disagree |
|
46 unsigned short? id = null; |
|
47 |
|
48 // these are deprecated due to renaming in the spec, but still supported for Fx22 |
|
49 boolean outOfOrderAllowed; // now ordered, and the default changes to keep behavior the same |
|
50 unsigned short maxRetransmitNum; // now maxRetransmits |
|
51 boolean preset; // now negotiated |
|
52 unsigned short stream; // now id |
|
53 }; |
|
54 |
|
55 // Misnomer dictionaries housing PeerConnection-specific constraints. |
|
56 // |
|
57 // Important! Do not ever add members that might need tracing (e.g. object) |
|
58 // to MediaConstraintSet or any dictionary marked XxxInternal here |
|
59 |
|
60 dictionary MediaConstraintSet { |
|
61 boolean OfferToReceiveAudio; |
|
62 boolean OfferToReceiveVideo; |
|
63 boolean MozDontOfferDataChannel; |
|
64 boolean MozBundleOnly; |
|
65 }; |
|
66 |
|
67 // MediaConstraint = single-property-subset of MediaConstraintSet |
|
68 // Implemented as full set. Test Object.keys(pair).length == 1 |
|
69 |
|
70 // typedef MediaConstraintSet MediaConstraint; // TODO: Bug 913053 |
|
71 |
|
72 dictionary MediaConstraints { |
|
73 object mandatory; // so we can see unknown + unsupported constraints |
|
74 sequence<MediaConstraintSet> _optional; // a.k.a. MediaConstraint |
|
75 }; |
|
76 |
|
77 dictionary MediaConstraintsInternal { |
|
78 MediaConstraintSet mandatory; // holds only supported constraints |
|
79 sequence<MediaConstraintSet> _optional; // a.k.a. MediaConstraint |
|
80 }; |
|
81 |
|
82 interface RTCDataChannel; |
|
83 |
|
84 [Pref="media.peerconnection.enabled", |
|
85 JSImplementation="@mozilla.org/dom/peerconnection;1", |
|
86 Constructor (optional RTCConfiguration configuration, |
|
87 optional object? constraints)] |
|
88 // moz-prefixed until sufficiently standardized. |
|
89 interface mozRTCPeerConnection : EventTarget { |
|
90 [Pref="media.peerconnection.identity.enabled"] |
|
91 void setIdentityProvider (DOMString provider, |
|
92 optional DOMString protocol, |
|
93 optional DOMString username); |
|
94 [Pref="media.peerconnection.identity.enabled"] |
|
95 void getIdentityAssertion(); |
|
96 void createOffer (RTCSessionDescriptionCallback successCallback, |
|
97 RTCPeerConnectionErrorCallback failureCallback, |
|
98 optional MediaConstraints constraints); |
|
99 void createAnswer (RTCSessionDescriptionCallback successCallback, |
|
100 RTCPeerConnectionErrorCallback failureCallback, |
|
101 optional MediaConstraints constraints); |
|
102 void setLocalDescription (mozRTCSessionDescription description, |
|
103 optional VoidFunction successCallback, |
|
104 optional RTCPeerConnectionErrorCallback failureCallback); |
|
105 void setRemoteDescription (mozRTCSessionDescription description, |
|
106 optional VoidFunction successCallback, |
|
107 optional RTCPeerConnectionErrorCallback failureCallback); |
|
108 readonly attribute mozRTCSessionDescription? localDescription; |
|
109 readonly attribute mozRTCSessionDescription? remoteDescription; |
|
110 readonly attribute RTCSignalingState signalingState; |
|
111 void updateIce (optional RTCConfiguration configuration, |
|
112 optional MediaConstraints constraints); |
|
113 void addIceCandidate (mozRTCIceCandidate candidate, |
|
114 optional VoidFunction successCallback, |
|
115 optional RTCPeerConnectionErrorCallback failureCallback); |
|
116 readonly attribute RTCIceGatheringState iceGatheringState; |
|
117 readonly attribute RTCIceConnectionState iceConnectionState; |
|
118 [Pref="media.peerconnection.identity.enabled"] |
|
119 readonly attribute RTCIdentityAssertion? peerIdentity; |
|
120 |
|
121 sequence<MediaStream> getLocalStreams (); |
|
122 sequence<MediaStream> getRemoteStreams (); |
|
123 MediaStream? getStreamById (DOMString streamId); |
|
124 void addStream (MediaStream stream, optional MediaConstraints constraints); |
|
125 void removeStream (MediaStream stream); |
|
126 void close (); |
|
127 attribute EventHandler onnegotiationneeded; |
|
128 attribute EventHandler onicecandidate; |
|
129 attribute EventHandler onsignalingstatechange; |
|
130 attribute EventHandler onaddstream; |
|
131 attribute EventHandler onremovestream; |
|
132 attribute EventHandler oniceconnectionstatechange; |
|
133 |
|
134 void getStats (MediaStreamTrack? selector, |
|
135 RTCStatsCallback successCallback, |
|
136 RTCPeerConnectionErrorCallback failureCallback); |
|
137 |
|
138 // Data channel. |
|
139 RTCDataChannel createDataChannel (DOMString label, |
|
140 optional RTCDataChannelInit dataChannelDict); |
|
141 attribute EventHandler ondatachannel; |
|
142 attribute EventHandler onconnection; |
|
143 attribute EventHandler onclosedconnection; |
|
144 [Pref="media.peerconnection.identity.enabled"] |
|
145 attribute EventHandler onidentityresult; |
|
146 [Pref="media.peerconnection.identity.enabled"] |
|
147 attribute EventHandler onpeeridentity; |
|
148 [Pref="media.peerconnection.identity.enabled"] |
|
149 attribute EventHandler onidpassertionerror; |
|
150 [Pref="media.peerconnection.identity.enabled"] |
|
151 attribute EventHandler onidpvalidationerror; |
|
152 }; |