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/.
6 * PeerConnection.js' interface to the C++ PeerConnectionImpl.
8 * Do not confuse with RTCPeerConnection. This interface is purely for
9 * communication between the PeerConnection JS DOM binding and the C++
12 * See media/webrtc/signaling/include/PeerConnectionImpl.h
16 interface nsISupports;
18 callback ChainedOperation = Promise<any> ();
20 /* Must be created first. Observer events will be dispatched on the thread provided */
23 interface PeerConnectionImpl {
26 /* Must be called first. Observer events dispatched on the thread provided */
28 undefined initialize(PeerConnectionObserver observer, Window window);
32 undefined createOffer(optional RTCOfferOptions options = {});
34 undefined createAnswer();
36 undefined setLocalDescription(long action, DOMString sdp);
38 undefined setRemoteDescription(long action, DOMString sdp);
40 Promise<RTCStatsReport> getStats(MediaStreamTrack? selector);
42 sequence<MediaStream> getRemoteStreams();
44 /* Adds the tracks created by GetUserMedia */
46 RTCRtpTransceiver addTransceiver(RTCRtpTransceiverInit init,
48 MediaStreamTrack? sendTrack,
49 boolean addTrackMagic);
50 sequence<RTCRtpTransceiver> getTransceivers();
53 undefined closeStreams();
56 undefined enablePacketDump(unsigned long level,
57 mozPacketDumpType type,
61 undefined disablePacketDump(unsigned long level,
62 mozPacketDumpType type,
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
71 undefined addIceCandidate(DOMString candidate,
74 unsigned short? level);
76 /* Shuts down threads, deletes state */
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
91 Promise<undefined> onSetDescriptionSuccess(RTCSdpType type, boolean remote);
93 undefined onSetDescriptionError();
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;
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;
117 attribute DOMString peerIdentity;
118 readonly attribute boolean privacyRequested;
120 readonly attribute RTCSctpTransport? sctp;
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);
130 Promise<any> chain(ChainedOperation op);
131 undefined updateNegotiationNeeded();
133 boolean createdSender(RTCRtpSender sender);