Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / webidl / RTCPeerConnection.webidl
blob2c3eb41a0722055beeee6237db5ce9f66695e020
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  */
10 callback RTCSessionDescriptionCallback = void (mozRTCSessionDescription sdp);
11 callback RTCPeerConnectionErrorCallback = void (DOMString errorInformation);
12 callback VoidFunction = void ();
13 callback RTCStatsCallback = void (RTCStatsReport report);
15 enum RTCSignalingState {
16     "stable",
17     "have-local-offer",
18     "have-remote-offer",
19     "have-local-pranswer",
20     "have-remote-pranswer",
21     "closed"
24 enum RTCIceGatheringState {
25     "new",
26     "gathering",
27     "complete"
30 enum RTCIceConnectionState {
31     "new",
32     "checking",
33     "connected",
34     "completed",
35     "failed",
36     "disconnected",
37     "closed"
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;
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
55 dictionary RTCOfferOptions {
56   long    offerToReceiveVideo;
57   long    offerToReceiveAudio;
58   boolean mozDontOfferDataChannel;
59   boolean mozBundleOnly;
61   // TODO: Remove old constraint-like RTCOptions support soon (Bug 1064223).
62   DeprecatedRTCOfferOptionsSet mandatory;
63   sequence<DeprecatedRTCOfferOptionsSet> _optional;
66 dictionary DeprecatedRTCOfferOptionsSet {
67   boolean OfferToReceiveAudio;     // Note the uppercase 'O'
68   boolean OfferToReceiveVideo;     // Note the uppercase 'O'
69   boolean MozDontOfferDataChannel; // Note the uppercase 'M'
70   boolean MozBundleOnly;           // Note the uppercase 'M'
73 interface RTCDataChannel;
75 [Pref="media.peerconnection.enabled",
76  JSImplementation="@mozilla.org/dom/peerconnection;1",
77  Constructor (optional RTCConfiguration configuration,
78               optional object? constraints)]
79 // moz-prefixed until sufficiently standardized.
80 interface mozRTCPeerConnection : EventTarget  {
81   [Pref="media.peerconnection.identity.enabled"]
82   void setIdentityProvider (DOMString provider,
83                             optional DOMString protocol,
84                             optional DOMString username);
85   [Pref="media.peerconnection.identity.enabled"]
86   void getIdentityAssertion();
87   void createOffer (RTCSessionDescriptionCallback successCallback,
88                     RTCPeerConnectionErrorCallback failureCallback,
89                     optional RTCOfferOptions options);
90   void createAnswer (RTCSessionDescriptionCallback successCallback,
91                      RTCPeerConnectionErrorCallback failureCallback);
92   void setLocalDescription (mozRTCSessionDescription description,
93                             optional VoidFunction successCallback,
94                             optional RTCPeerConnectionErrorCallback failureCallback);
95   void setRemoteDescription (mozRTCSessionDescription description,
96                              optional VoidFunction successCallback,
97                              optional RTCPeerConnectionErrorCallback failureCallback);
98   readonly attribute mozRTCSessionDescription? localDescription;
99   readonly attribute mozRTCSessionDescription? remoteDescription;
100   readonly attribute RTCSignalingState signalingState;
101   void updateIce (optional RTCConfiguration configuration);
102   void addIceCandidate (mozRTCIceCandidate candidate,
103                         optional VoidFunction successCallback,
104                         optional RTCPeerConnectionErrorCallback failureCallback);
105   readonly attribute RTCIceGatheringState iceGatheringState;
106   readonly attribute RTCIceConnectionState iceConnectionState;
107   [Pref="media.peerconnection.identity.enabled"]
108   readonly attribute RTCIdentityAssertion? peerIdentity;
110   [ChromeOnly]
111   readonly attribute DOMString id;
113   RTCConfiguration      getConfiguration ();
114   sequence<MediaStream> getLocalStreams ();
115   sequence<MediaStream> getRemoteStreams ();
116   MediaStream? getStreamById (DOMString streamId);
117   void addStream (MediaStream stream);
118   void removeStream (MediaStream stream);
120   // replaces addStream; fails if already added
121   // because a track can be part of multiple streams, stream parameters
122   // indicate which particular streams should be referenced in signaling
124   RTCRtpSender addTrack(MediaStreamTrack track,
125                         MediaStream stream,
126                         MediaStream... moreStreams);
127   void removeTrack(RTCRtpSender sender);
129   sequence<RTCRtpSender> getSenders();
130   sequence<RTCRtpReceiver> getReceivers();
132   void close ();
133   attribute EventHandler onnegotiationneeded;
134   attribute EventHandler onicecandidate;
135   attribute EventHandler onsignalingstatechange;
136   attribute EventHandler onaddstream;
137   attribute EventHandler onaddtrack;  // replaces onaddstream; see AddTrackEvent
138   attribute EventHandler onremovestream;
139   attribute EventHandler oniceconnectionstatechange;
141   void getStats (MediaStreamTrack? selector,
142                  RTCStatsCallback successCallback,
143                  RTCPeerConnectionErrorCallback failureCallback);
145   // Data channel.
146   RTCDataChannel createDataChannel (DOMString label,
147                                     optional RTCDataChannelInit dataChannelDict);
148   attribute EventHandler ondatachannel;
149   [Pref="media.peerconnection.identity.enabled"]
150   attribute EventHandler onidentityresult;
151   [Pref="media.peerconnection.identity.enabled"]
152   attribute EventHandler onpeeridentity;
153   [Pref="media.peerconnection.identity.enabled"]
154   attribute EventHandler onidpassertionerror;
155   [Pref="media.peerconnection.identity.enabled"]
156   attribute EventHandler onidpvalidationerror;