Bug 1634779 - pt 2. Partially revert Bug 1603006 r=kmag
[gecko.git] / dom / webidl / PeerConnectionImpl.webidl
blob3065953314e7903766b33ba5ab921850c5abd6bf
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 /* Must be created first. Observer events will be dispatched on the thread provided */
19 [ChromeOnly,
20  Exposed=Window]
21 interface PeerConnectionImpl  {
22   constructor();
24   /* Must be called first. Observer events dispatched on the thread provided */
25   [Throws]
26   void initialize(PeerConnectionObserver observer, Window window,
27                   RTCConfiguration iceServers,
28                   nsISupports thread);
30   /* JSEP calls */
31   [Throws]
32   void createOffer(optional RTCOfferOptions options = {});
33   [Throws]
34   void createAnswer();
35   [Throws]
36   void setLocalDescription(long action, DOMString sdp);
37   [Throws]
38   void 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   TransceiverImpl createTransceiverImpl(DOMString kind,
47                                         MediaStreamTrack? track);
48   [Throws]
49   boolean checkNegotiationNeeded();
51   [Throws]
52   void replaceTrackNoRenegotiation(TransceiverImpl transceiverImpl,
53                                    MediaStreamTrack? withTrack);
54   [Throws]
55   void closeStreams();
57   [Throws]
58   void enablePacketDump(unsigned long level,
59                         mozPacketDumpType type,
60                         boolean sending);
62   [Throws]
63   void disablePacketDump(unsigned long level,
64                          mozPacketDumpType type,
65                          boolean sending);
67   /* As the ICE candidates roll in this one should be called each time
68    * in order to keep the candidate list up-to-date for the next SDP-related
69    * call PeerConnectionImpl does not parse ICE candidates, just sticks them
70    * into the SDP.
71    */
72   [Throws]
73   void addIceCandidate(DOMString candidate,
74                        DOMString mid,
75                        DOMString ufrag,
76                        unsigned short? level);
78   /* Shuts down threads, deletes state */
79   [Throws]
80   void close();
82   /* Notify DOM window if this plugin crash is ours. */
83   boolean pluginCrash(unsigned long long pluginId, DOMString name);
85   /* Attributes */
86   /* This provides the implementation with the certificate it uses to
87    * authenticate itself.  The JS side must set this before calling
88    * createOffer/createAnswer or retrieving the value of fingerprint.  This has
89    * to be delayed because generating the certificate takes some time. */
90   attribute RTCCertificate certificate;
91   [Constant]
92   readonly attribute DOMString fingerprint;
93   readonly attribute DOMString currentLocalDescription;
94   readonly attribute DOMString pendingLocalDescription;
95   readonly attribute DOMString currentRemoteDescription;
96   readonly attribute DOMString pendingRemoteDescription;
97   readonly attribute boolean? currentOfferer;
98   readonly attribute boolean? pendingOfferer;
100   readonly attribute RTCIceConnectionState iceConnectionState;
101   readonly attribute RTCIceGatheringState iceGatheringState;
102   readonly attribute RTCSignalingState signalingState;
103   attribute DOMString id;
105   [SetterThrows]
106   attribute DOMString peerIdentity;
107   readonly attribute boolean privacyRequested;
109   /* Data channels */
110   [Throws]
111   RTCDataChannel createDataChannel(DOMString label, DOMString protocol,
112     unsigned short type, boolean ordered,
113     unsigned short maxTime, unsigned short maxNum,
114     boolean externalNegotiated, unsigned short stream);