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 * The origin of this IDL file is
7 * http://w3c.github.io/webrtc-pc/#interface-definition
10 callback RTCSessionDescriptionCallback = undefined (RTCSessionDescriptionInit description);
11 callback RTCPeerConnectionErrorCallback = undefined (DOMException error);
12 callback RTCStatsCallback = undefined (RTCStatsReport report);
14 enum RTCSignalingState {
18 "have-local-pranswer",
19 "have-remote-pranswer",
23 enum RTCIceGatheringState {
29 enum RTCIceConnectionState {
39 enum RTCPeerConnectionState {
48 enum mozPacketDumpType {
49 "rtp", // dump unencrypted rtp as the MediaPipeline sees it
50 "srtp", // dump encrypted rtp as the MediaPipeline sees it
51 "rtcp", // dump unencrypted rtcp as the MediaPipeline sees it
52 "srtcp" // dump encrypted rtcp as the MediaPipeline sees it
55 callback mozPacketCallback = undefined (unsigned long level,
56 mozPacketDumpType type,
60 dictionary RTCDataChannelInit {
61 boolean ordered = true;
63 unsigned short maxPacketLifeTime;
65 unsigned short maxRetransmits;
66 DOMString protocol = "";
67 boolean negotiated = false;
71 // These are deprecated due to renaming in the spec, but still supported for Fx53
72 unsigned short maxRetransmitTime;
75 dictionary RTCOfferAnswerOptions {
76 // boolean voiceActivityDetection = true; // TODO: support this (Bug 1184712)
79 dictionary RTCAnswerOptions : RTCOfferAnswerOptions {
82 dictionary RTCOfferOptions : RTCOfferAnswerOptions {
83 boolean offerToReceiveVideo;
84 boolean offerToReceiveAudio;
85 boolean iceRestart = false;
88 [Pref="media.peerconnection.enabled",
89 JSImplementation="@mozilla.org/dom/peerconnection;1",
91 interface RTCPeerConnection : EventTarget {
93 constructor(optional RTCConfiguration configuration = {});
95 [Throws, StaticClassOverride="mozilla::dom::RTCCertificate"]
96 static Promise<RTCCertificate> generateCertificate (AlgorithmIdentifier keygenAlgorithm);
98 undefined setIdentityProvider (DOMString provider,
99 optional RTCIdentityProviderOptions options = {});
100 Promise<DOMString> getIdentityAssertion();
101 Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options = {});
102 Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options = {});
103 Promise<undefined> setLocalDescription(optional RTCLocalSessionDescriptionInit description = {});
104 readonly attribute RTCSessionDescription? localDescription;
105 readonly attribute RTCSessionDescription? currentLocalDescription;
106 readonly attribute RTCSessionDescription? pendingLocalDescription;
107 Promise<undefined> setRemoteDescription(RTCSessionDescriptionInit description);
108 readonly attribute RTCSessionDescription? remoteDescription;
109 readonly attribute RTCSessionDescription? currentRemoteDescription;
110 readonly attribute RTCSessionDescription? pendingRemoteDescription;
111 readonly attribute RTCSignalingState signalingState;
112 Promise<undefined> addIceCandidate (optional (RTCIceCandidateInit or RTCIceCandidate) candidate = {});
113 readonly attribute boolean? canTrickleIceCandidates;
114 readonly attribute RTCIceGatheringState iceGatheringState;
115 readonly attribute RTCIceConnectionState iceConnectionState;
116 readonly attribute RTCPeerConnectionState connectionState;
117 undefined restartIce ();
118 readonly attribute Promise<RTCIdentityAssertion> peerIdentity;
119 readonly attribute DOMString? idpLoginUrl;
122 attribute DOMString id;
124 RTCConfiguration getConfiguration ();
125 undefined setConfiguration(optional RTCConfiguration configuration = {});
126 [Deprecated="RTCPeerConnectionGetStreams"]
127 sequence<MediaStream> getLocalStreams ();
128 [Deprecated="RTCPeerConnectionGetStreams"]
129 sequence<MediaStream> getRemoteStreams ();
130 undefined addStream (MediaStream stream);
132 // replaces addStream; fails if already added
133 // because a track can be part of multiple streams, stream parameters
134 // indicate which particular streams should be referenced in signaling
136 RTCRtpSender addTrack(MediaStreamTrack track,
137 MediaStream... streams);
138 undefined removeTrack(RTCRtpSender sender);
141 RTCRtpTransceiver addTransceiver((MediaStreamTrack or DOMString) trackOrKind,
142 optional RTCRtpTransceiverInit init = {});
144 sequence<RTCRtpSender> getSenders();
145 sequence<RTCRtpReceiver> getReceivers();
146 sequence<RTCRtpTransceiver> getTransceivers();
149 undefined mozSetPacketCallback(mozPacketCallback callback);
151 undefined mozEnablePacketDump(unsigned long level,
152 mozPacketDumpType type,
155 undefined mozDisablePacketDump(unsigned long level,
156 mozPacketDumpType type,
160 attribute EventHandler onnegotiationneeded;
161 attribute EventHandler onicecandidate;
162 attribute EventHandler onsignalingstatechange;
163 attribute EventHandler onaddstream; // obsolete
164 attribute EventHandler onaddtrack; // obsolete
165 attribute EventHandler ontrack; // replaces onaddtrack and onaddstream.
166 attribute EventHandler oniceconnectionstatechange;
167 attribute EventHandler onicegatheringstatechange;
168 attribute EventHandler onconnectionstatechange;
170 Promise<RTCStatsReport> getStats (optional MediaStreamTrack? selector = null);
172 readonly attribute RTCSctpTransport? sctp;
174 RTCDataChannel createDataChannel (DOMString label,
175 optional RTCDataChannelInit dataChannelDict = {});
176 attribute EventHandler ondatachannel;
179 // Legacy callback API
181 partial interface RTCPeerConnection {
183 // Legacy Interface Extensions
184 // Supporting the methods in this section is optional.
185 // If these methods are supported
186 // they must be implemented as defined
187 // in section "Legacy Interface Extensions"
188 Promise<undefined> createOffer(RTCSessionDescriptionCallback successCallback,
189 RTCPeerConnectionErrorCallback failureCallback,
190 optional RTCOfferOptions options = {});
191 Promise<undefined> setLocalDescription(RTCLocalSessionDescriptionInit description,
192 VoidFunction successCallback,
193 RTCPeerConnectionErrorCallback failureCallback);
194 Promise<undefined> createAnswer(RTCSessionDescriptionCallback successCallback,
195 RTCPeerConnectionErrorCallback failureCallback);
196 Promise<undefined> setRemoteDescription(RTCSessionDescriptionInit description,
197 VoidFunction successCallback,
198 RTCPeerConnectionErrorCallback failureCallback);
199 Promise<undefined> addIceCandidate(RTCIceCandidateInit candidate,
200 VoidFunction successCallback,
201 RTCPeerConnectionErrorCallback failureCallback);