]> git.proxmox.com Git - rustc.git/blob - vendor/web-sys/webidls/enabled/RTCPeerConnection.webidl
New upstream version 1.72.1+dfsg1
[rustc.git] / vendor / web-sys / webidls / enabled / RTCPeerConnection.webidl
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://w3c.github.io/webrtc-pc/#interface-definition
8 */
9
10 callback RTCSessionDescriptionCallback = undefined (RTCSessionDescriptionInit description);
11 callback RTCPeerConnectionErrorCallback = undefined (DOMException error);
12 callback RTCStatsCallback = undefined (RTCStatsReport report);
13
14 enum RTCSignalingState {
15 "stable",
16 "have-local-offer",
17 "have-remote-offer",
18 "have-local-pranswer",
19 "have-remote-pranswer",
20 "closed"
21 };
22
23 enum RTCIceGatheringState {
24 "new",
25 "gathering",
26 "complete"
27 };
28
29 enum RTCIceConnectionState {
30 "new",
31 "checking",
32 "connected",
33 "completed",
34 "failed",
35 "disconnected",
36 "closed"
37 };
38
39 enum RTCPeerConnectionState {
40 "closed",
41 "failed",
42 "disconnected",
43 "new",
44 "connecting",
45 "connected"
46 };
47
48 dictionary RTCDataChannelInit {
49 boolean ordered = true;
50 unsigned short maxPacketLifeTime;
51 unsigned short maxRetransmits;
52 DOMString protocol = "";
53 boolean negotiated = false;
54 unsigned short id;
55
56 // These are deprecated due to renaming in the spec, but still supported for Fx53
57 unsigned short maxRetransmitTime;
58 };
59
60 dictionary RTCOfferAnswerOptions {
61 // boolean voiceActivityDetection = true; // TODO: support this (Bug 1184712)
62 };
63
64 dictionary RTCAnswerOptions : RTCOfferAnswerOptions {
65 };
66
67 dictionary RTCOfferOptions : RTCOfferAnswerOptions {
68 boolean offerToReceiveVideo;
69 boolean offerToReceiveAudio;
70 boolean iceRestart = false;
71 };
72
73 [Pref="media.peerconnection.enabled",
74 JSImplementation="@mozilla.org/dom/peerconnection;1",
75 Constructor (optional RTCConfiguration configuration,
76 optional object? constraints)]
77 interface RTCPeerConnection : EventTarget {
78 [Throws, StaticClassOverride="mozilla::dom::RTCCertificate"]
79 static Promise<RTCCertificate> generateCertificate (AlgorithmIdentifier keygenAlgorithm);
80
81 [Pref="media.peerconnection.identity.enabled"]
82 undefined setIdentityProvider (DOMString provider,
83 optional RTCIdentityProviderOptions options);
84 [Pref="media.peerconnection.identity.enabled"]
85 Promise<DOMString> getIdentityAssertion();
86 Promise<RTCSessionDescriptionInit> createOffer (optional RTCOfferOptions options);
87 Promise<RTCSessionDescriptionInit> createAnswer (optional RTCAnswerOptions options);
88 Promise<undefined> setLocalDescription (RTCSessionDescriptionInit description);
89 Promise<undefined> setRemoteDescription (RTCSessionDescriptionInit description);
90 readonly attribute RTCSessionDescription? localDescription;
91 readonly attribute RTCSessionDescription? currentLocalDescription;
92 readonly attribute RTCSessionDescription? pendingLocalDescription;
93 readonly attribute RTCSessionDescription? remoteDescription;
94 readonly attribute RTCSessionDescription? currentRemoteDescription;
95 readonly attribute RTCSessionDescription? pendingRemoteDescription;
96 readonly attribute RTCSignalingState signalingState;
97 Promise<undefined> addIceCandidate ((RTCIceCandidateInit or RTCIceCandidate)? candidate);
98 readonly attribute boolean? canTrickleIceCandidates;
99 readonly attribute RTCIceGatheringState iceGatheringState;
100 readonly attribute RTCIceConnectionState iceConnectionState;
101 readonly attribute RTCPeerConnectionState connectionState;
102 [Pref="media.peerconnection.identity.enabled"]
103 readonly attribute Promise<RTCIdentityAssertion> peerIdentity;
104 [Pref="media.peerconnection.identity.enabled"]
105 readonly attribute DOMString? idpLoginUrl;
106
107 [ChromeOnly]
108 attribute DOMString id;
109
110 RTCConfiguration getConfiguration ();
111 [Deprecated="RTCPeerConnectionGetStreams"]
112 sequence<MediaStream> getLocalStreams ();
113 [Deprecated="RTCPeerConnectionGetStreams"]
114 sequence<MediaStream> getRemoteStreams ();
115 undefined addStream (MediaStream stream);
116
117 // replaces addStream; fails if already added
118 // because a track can be part of multiple streams, stream parameters
119 // indicate which particular streams should be referenced in signaling
120
121 RTCRtpSender addTrack(MediaStreamTrack track,
122 MediaStream stream,
123 MediaStream... moreStreams);
124 undefined removeTrack(RTCRtpSender sender);
125
126 RTCRtpTransceiver addTransceiver((MediaStreamTrack or DOMString) trackOrKind,
127 optional RTCRtpTransceiverInit init);
128
129 sequence<RTCRtpSender> getSenders();
130 sequence<RTCRtpReceiver> getReceivers();
131 sequence<RTCRtpTransceiver> getTransceivers();
132
133 undefined close ();
134 attribute EventHandler onnegotiationneeded;
135 attribute EventHandler onicecandidate;
136 attribute EventHandler onsignalingstatechange;
137 attribute EventHandler onaddstream; // obsolete
138 attribute EventHandler onaddtrack; // obsolete
139 attribute EventHandler ontrack; // replaces onaddtrack and onaddstream.
140 attribute EventHandler onremovestream;
141 attribute EventHandler oniceconnectionstatechange;
142 attribute EventHandler onicegatheringstatechange;
143 attribute EventHandler onconnectionstatechange;
144
145 Promise<RTCStatsReport> getStats (optional MediaStreamTrack? selector);
146
147 // Data channel.
148 RTCDataChannel createDataChannel (DOMString label,
149 optional RTCDataChannelInit dataChannelDict);
150 attribute EventHandler ondatachannel;
151 };
152
153 // Legacy callback API
154
155 partial interface RTCPeerConnection {
156
157 // Dummy Promise<undefined> return values avoid "WebIDL.WebIDLError: error:
158 // We have overloads with both Promise and non-Promise return types"
159
160 Promise<undefined> createOffer (RTCSessionDescriptionCallback successCallback,
161 RTCPeerConnectionErrorCallback failureCallback,
162 optional RTCOfferOptions options);
163 Promise<undefined> createAnswer (RTCSessionDescriptionCallback successCallback,
164 RTCPeerConnectionErrorCallback failureCallback);
165 Promise<undefined> setLocalDescription (RTCSessionDescriptionInit description,
166 VoidFunction successCallback,
167 RTCPeerConnectionErrorCallback failureCallback);
168 Promise<undefined> setRemoteDescription (RTCSessionDescriptionInit description,
169 VoidFunction successCallback,
170 RTCPeerConnectionErrorCallback failureCallback);
171 Promise<undefined> addIceCandidate (RTCIceCandidate candidate,
172 VoidFunction successCallback,
173 RTCPeerConnectionErrorCallback failureCallback);
174 Promise<undefined> getStats (MediaStreamTrack? selector,
175 RTCStatsCallback successCallback,
176 RTCPeerConnectionErrorCallback failureCallback);
177 };