Merge mozilla-central to autoland on a CLOSED TREE
[gecko.git] / dom / webidl / PeerConnectionImpl.webidl
blob5b59b629e5008349da212997023a831144e50023
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  * PeerConnection.js' interface to the C++ PeerConnectionImpl.
7  *
8  * Do not confuse with RTCPeerConnection. This interface is purely for
9  * communication between the PeerConnection JS DOM binding and the C++
10  * implementation.
11  *
12  * See media/webrtc/signaling/include/PeerConnectionImpl.h
13  *
14  */
16 interface nsISupports;
18 callback ChainedOperation = Promise<any> ();
20 /* Must be created first. Observer events will be dispatched on the thread provided */
21 [ChromeOnly,
22  Exposed=Window]
23 interface PeerConnectionImpl  {
24   constructor();
26   /* Must be called first. Observer events dispatched on the thread provided */
27   [Throws]
28   undefined initialize(PeerConnectionObserver observer, Window window);
30   /* JSEP calls */
31   [Throws]
32   undefined createOffer(optional RTCOfferOptions options = {});
33   [Throws]
34   undefined createAnswer();
35   [Throws]
36   undefined setLocalDescription(long action, DOMString sdp);
37   [Throws]
38   undefined setRemoteDescription(long action, DOMString sdp);
40   Promise<RTCStatsReport> getStats(MediaStreamTrack? selector);
42   sequence<MediaStream> getRemoteStreams();
44   /* Adds the tracks created by GetUserMedia */
45   [Throws]
46   RTCRtpTransceiver addTransceiver(RTCRtpTransceiverInit init,
47                                    DOMString kind,
48                                    MediaStreamTrack? sendTrack,
49                                    boolean addTrackMagic);
50   sequence<RTCRtpTransceiver> getTransceivers();
52   [Throws]
53   undefined closeStreams();
55   [Throws]
56   undefined enablePacketDump(unsigned long level,
57                              mozPacketDumpType type,
58                              boolean sending);
60   [Throws]
61   undefined disablePacketDump(unsigned long level,
62                               mozPacketDumpType type,
63                               boolean sending);
65   /* As the ICE candidates roll in this one should be called each time
66    * in order to keep the candidate list up-to-date for the next SDP-related
67    * call PeerConnectionImpl does not parse ICE candidates, just sticks them
68    * into the SDP.
69    */
70   [Throws]
71   undefined addIceCandidate(DOMString candidate,
72                             DOMString mid,
73                             DOMString ufrag,
74                             unsigned short? level);
76   /* Shuts down threads, deletes state */
77   [Throws]
78   undefined close();
80   [Throws]
81   undefined setConfiguration(optional RTCConfiguration config = {});
83   undefined restartIce();
84   undefined restartIceNoRenegotiationNeeded();
86   /* Notify DOM window if this plugin crash is ours. */
87   boolean pluginCrash(unsigned long long pluginId, DOMString name);
89   // Only throws if promise creation fails
90   [Throws]
91   Promise<undefined> onSetDescriptionSuccess(RTCSdpType type, boolean remote);
93   undefined onSetDescriptionError();
95   /* Attributes */
96   /* This provides the implementation with the certificate it uses to
97    * authenticate itself.  The JS side must set this before calling
98    * createOffer/createAnswer or retrieving the value of fingerprint.  This has
99    * to be delayed because generating the certificate takes some time. */
100   attribute RTCCertificate certificate;
101   [Constant]
102   readonly attribute DOMString fingerprint;
103   readonly attribute DOMString currentLocalDescription;
104   readonly attribute DOMString pendingLocalDescription;
105   readonly attribute DOMString currentRemoteDescription;
106   readonly attribute DOMString pendingRemoteDescription;
107   readonly attribute boolean? currentOfferer;
108   readonly attribute boolean? pendingOfferer;
110   readonly attribute RTCIceConnectionState iceConnectionState;
111   readonly attribute RTCIceGatheringState iceGatheringState;
112   readonly attribute RTCPeerConnectionState connectionState;
113   readonly attribute RTCSignalingState signalingState;
114   attribute DOMString id;
116   [SetterThrows]
117   attribute DOMString peerIdentity;
118   readonly attribute boolean privacyRequested;
120   readonly attribute RTCSctpTransport? sctp;
122   /* Data channels */
123   [Throws]
124   RTCDataChannel createDataChannel(DOMString label, DOMString protocol,
125     unsigned short type, boolean ordered,
126     unsigned short maxTime, unsigned short maxNum,
127     boolean externalNegotiated, unsigned short stream);
129   [Throws]
130   Promise<any> chain(ChainedOperation op);
131   undefined updateNegotiationNeeded();
133   boolean createdSender(RTCRtpSender sender);