-
Notifications
You must be signed in to change notification settings - Fork 72
/
webrtc.idl
623 lines (538 loc) · 17.3 KB
/
webrtc.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into reffy-reports
// (https://github.com/tidoust/reffy-reports)
// Source: WebRTC 1.0: Real-time Communication Between Browsers (https://w3c.github.io/webrtc-pc/)
dictionary RTCConfiguration {
sequence<RTCIceServer> iceServers;
RTCIceTransportPolicy iceTransportPolicy;
RTCBundlePolicy bundlePolicy;
RTCRtcpMuxPolicy rtcpMuxPolicy;
sequence<RTCCertificate> certificates;
[EnforceRange] octet iceCandidatePoolSize = 0;
};
enum RTCIceCredentialType {
"password",
};
dictionary RTCIceServer {
required (DOMString or sequence<DOMString>) urls;
DOMString username;
RTCIceCredentialType credentialType = "password";
};
enum RTCIceTransportPolicy {
"relay",
"all"
};
enum RTCBundlePolicy {
"balanced",
"max-compat",
"max-bundle"
};
enum RTCRtcpMuxPolicy {
"require"
};
dictionary RTCOfferAnswerOptions {};
dictionary RTCOfferOptions : RTCOfferAnswerOptions {
boolean iceRestart = false;
};
dictionary RTCAnswerOptions : RTCOfferAnswerOptions {};
enum RTCSignalingState {
"stable",
"have-local-offer",
"have-remote-offer",
"have-local-pranswer",
"have-remote-pranswer",
"closed"
};
enum RTCIceGatheringState {
"new",
"gathering",
"complete"
};
enum RTCPeerConnectionState {
"closed",
"failed",
"disconnected",
"new",
"connecting",
"connected"
};
enum RTCIceConnectionState {
"closed",
"failed",
"disconnected",
"new",
"checking",
"completed",
"connected"
};
[Exposed=Window]
interface RTCPeerConnection : EventTarget {
constructor(optional RTCConfiguration configuration = {});
Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options = {});
Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options = {});
Promise<void> setLocalDescription(optional RTCSessionDescriptionInit description = {});
readonly attribute RTCSessionDescription? localDescription;
readonly attribute RTCSessionDescription? currentLocalDescription;
readonly attribute RTCSessionDescription? pendingLocalDescription;
Promise<void> setRemoteDescription(optional RTCSessionDescriptionInit description = {});
readonly attribute RTCSessionDescription? remoteDescription;
readonly attribute RTCSessionDescription? currentRemoteDescription;
readonly attribute RTCSessionDescription? pendingRemoteDescription;
Promise<void> addIceCandidate(optional RTCIceCandidateInit candidate = {});
readonly attribute RTCSignalingState signalingState;
readonly attribute RTCIceGatheringState iceGatheringState;
readonly attribute RTCIceConnectionState iceConnectionState;
readonly attribute RTCPeerConnectionState connectionState;
readonly attribute boolean? canTrickleIceCandidates;
void restartIce();
RTCConfiguration getConfiguration();
void setConfiguration(optional RTCConfiguration configuration = {});
void close();
attribute EventHandler onnegotiationneeded;
attribute EventHandler onicecandidate;
attribute EventHandler onicecandidateerror;
attribute EventHandler onsignalingstatechange;
attribute EventHandler oniceconnectionstatechange;
attribute EventHandler onicegatheringstatechange;
attribute EventHandler onconnectionstatechange;
// Legacy Interface Extensions
// Supporting the methods in this section is optional.
// If these methods are supported
// they must be implemented as defined
// in section "Legacy Interface Extensions"
Promise<void> createOffer(RTCSessionDescriptionCallback successCallback,
RTCPeerConnectionErrorCallback failureCallback,
optional RTCOfferOptions options = {});
Promise<void> setLocalDescription(optional RTCSessionDescriptionInit description = {},
VoidFunction successCallback,
RTCPeerConnectionErrorCallback failureCallback);
Promise<void> createAnswer(RTCSessionDescriptionCallback successCallback,
RTCPeerConnectionErrorCallback failureCallback);
Promise<void> setRemoteDescription(optional RTCSessionDescriptionInit description = {},
VoidFunction successCallback,
RTCPeerConnectionErrorCallback failureCallback);
Promise<void> addIceCandidate(RTCIceCandidateInit candidate,
VoidFunction successCallback,
RTCPeerConnectionErrorCallback failureCallback);
};
callback RTCPeerConnectionErrorCallback = void (DOMException error);
callback RTCSessionDescriptionCallback = void (RTCSessionDescriptionInit description);
partial dictionary RTCOfferOptions {
boolean offerToReceiveAudio;
boolean offerToReceiveVideo;
};
enum RTCSdpType {
"offer",
"pranswer",
"answer",
"rollback"
};
[Exposed=Window]
interface RTCSessionDescription {
constructor(optional RTCSessionDescriptionInit descriptionInitDict = {});
readonly attribute RTCSdpType type;
readonly attribute DOMString sdp;
[Default] object toJSON();
};
dictionary RTCSessionDescriptionInit {
RTCSdpType type;
DOMString sdp = "";
};
[Exposed=Window]
interface RTCIceCandidate {
constructor(optional RTCIceCandidateInit candidateInitDict = {});
readonly attribute DOMString candidate;
readonly attribute DOMString? sdpMid;
readonly attribute unsigned short? sdpMLineIndex;
readonly attribute DOMString? foundation;
readonly attribute RTCIceComponent? component;
readonly attribute unsigned long? priority;
readonly attribute DOMString? address;
readonly attribute RTCIceProtocol? protocol;
readonly attribute unsigned short? port;
readonly attribute RTCIceCandidateType? type;
readonly attribute RTCIceTcpCandidateType? tcpType;
readonly attribute DOMString? relatedAddress;
readonly attribute unsigned short? relatedPort;
readonly attribute DOMString? usernameFragment;
RTCIceCandidateInit toJSON();
};
dictionary RTCIceCandidateInit {
DOMString candidate = "";
DOMString? sdpMid = null;
unsigned short? sdpMLineIndex = null;
DOMString? usernameFragment = null;
};
enum RTCIceProtocol {
"udp",
"tcp"
};
enum RTCIceTcpCandidateType {
"active",
"passive",
"so"
};
enum RTCIceCandidateType {
"host",
"srflx",
"prflx",
"relay"
};
[Exposed=Window]
interface RTCPeerConnectionIceEvent : Event {
constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict = {});
readonly attribute RTCIceCandidate? candidate;
readonly attribute DOMString? url;
};
dictionary RTCPeerConnectionIceEventInit : EventInit {
RTCIceCandidate? candidate;
DOMString? url;
};
[Exposed=Window]
interface RTCPeerConnectionIceErrorEvent : Event {
constructor(DOMString type, RTCPeerConnectionIceErrorEventInit eventInitDict);
readonly attribute DOMString? address;
readonly attribute unsigned short? port;
readonly attribute DOMString url;
readonly attribute unsigned short errorCode;
readonly attribute USVString errorText;
};
dictionary RTCPeerConnectionIceErrorEventInit : EventInit {
DOMString hostCandidate;
DOMString url;
required unsigned short errorCode;
USVString statusText;
};
partial interface RTCPeerConnection {
static Promise<RTCCertificate>
generateCertificate(AlgorithmIdentifier keygenAlgorithm);
};
dictionary RTCCertificateExpiration {
[EnforceRange] DOMTimeStamp expires;
};
[Exposed=Window, Serializable]
interface RTCCertificate {
readonly attribute DOMTimeStamp expires;
sequence<RTCDtlsFingerprint> getFingerprints();
};
partial interface RTCPeerConnection {
sequence<RTCRtpSender> getSenders();
sequence<RTCRtpReceiver> getReceivers();
sequence<RTCRtpTransceiver> getTransceivers();
RTCRtpSender addTrack(MediaStreamTrack track, MediaStream... streams);
void removeTrack(RTCRtpSender sender);
RTCRtpTransceiver addTransceiver((MediaStreamTrack or DOMString) trackOrKind,
optional RTCRtpTransceiverInit init = {});
attribute EventHandler ontrack;
};
dictionary RTCRtpTransceiverInit {
RTCRtpTransceiverDirection direction = "sendrecv";
sequence<MediaStream> streams = [];
sequence<RTCRtpEncodingParameters> sendEncodings = [];
};
enum RTCRtpTransceiverDirection {
"sendrecv",
"sendonly",
"recvonly",
"inactive",
"stopped"
};
[Exposed=Window]
interface RTCRtpSender {
readonly attribute MediaStreamTrack? track;
readonly attribute RTCDtlsTransport? transport;
static RTCRtpCapabilities? getCapabilities(DOMString kind);
Promise<void> setParameters(RTCRtpSendParameters parameters);
RTCRtpSendParameters getParameters();
Promise<void> replaceTrack(MediaStreamTrack? withTrack);
void setStreams(MediaStream... streams);
Promise<RTCStatsReport> getStats();
};
dictionary RTCRtpParameters {
required sequence<RTCRtpHeaderExtensionParameters> headerExtensions;
required RTCRtcpParameters rtcp;
required sequence<RTCRtpCodecParameters> codecs;
};
dictionary RTCRtpSendParameters : RTCRtpParameters {
required DOMString transactionId;
required sequence<RTCRtpEncodingParameters> encodings;
};
dictionary RTCRtpReceiveParameters : RTCRtpParameters {
};
dictionary RTCRtpCodingParameters {
DOMString rid;
};
dictionary RTCRtpDecodingParameters : RTCRtpCodingParameters {};
dictionary RTCRtpEncodingParameters : RTCRtpCodingParameters {
boolean active = true;
unsigned long maxBitrate;
double scaleResolutionDownBy;
};
dictionary RTCRtcpParameters {
DOMString cname;
boolean reducedSize;
};
dictionary RTCRtpHeaderExtensionParameters {
required DOMString uri;
required unsigned short id;
boolean encrypted = false;
};
dictionary RTCRtpCodecParameters {
required octet payloadType;
required DOMString mimeType;
required unsigned long clockRate;
unsigned short channels;
DOMString sdpFmtpLine;
};
dictionary RTCRtpCapabilities {
required sequence<RTCRtpCodecCapability> codecs;
required sequence<RTCRtpHeaderExtensionCapability> headerExtensions;
};
dictionary RTCRtpCodecCapability {
required DOMString mimeType;
required unsigned long clockRate;
unsigned short channels;
DOMString sdpFmtpLine;
};
dictionary RTCRtpHeaderExtensionCapability {
DOMString uri;
};
[Exposed=Window]
interface RTCRtpReceiver {
readonly attribute MediaStreamTrack track;
readonly attribute RTCDtlsTransport? transport;
static RTCRtpCapabilities? getCapabilities(DOMString kind);
RTCRtpReceiveParameters getParameters();
sequence<RTCRtpContributingSource> getContributingSources();
sequence<RTCRtpSynchronizationSource> getSynchronizationSources();
Promise<RTCStatsReport> getStats();
};
dictionary RTCRtpContributingSource {
required DOMHighResTimeStamp timestamp;
required unsigned long source;
double audioLevel;
required unsigned long rtpTimestamp;
};
dictionary RTCRtpSynchronizationSource : RTCRtpContributingSource {
boolean voiceActivityFlag;
};
[Exposed=Window]
interface RTCRtpTransceiver {
readonly attribute DOMString? mid;
[SameObject] readonly attribute RTCRtpSender sender;
[SameObject] readonly attribute RTCRtpReceiver receiver;
attribute RTCRtpTransceiverDirection direction;
readonly attribute RTCRtpTransceiverDirection? currentDirection;
void stop();
void setCodecPreferences(sequence<RTCRtpCodecCapability> codecs);
};
[Exposed=Window]
interface RTCDtlsTransport : EventTarget {
[SameObject] readonly attribute RTCIceTransport iceTransport;
readonly attribute RTCDtlsTransportState state;
sequence<ArrayBuffer> getRemoteCertificates();
attribute EventHandler onstatechange;
attribute EventHandler onerror;
};
enum RTCDtlsTransportState {
"new",
"connecting",
"connected",
"closed",
"failed"
};
dictionary RTCDtlsFingerprint {
DOMString algorithm;
DOMString value;
};
[Exposed=Window]
interface RTCIceTransport : EventTarget {
readonly attribute RTCIceRole role;
readonly attribute RTCIceComponent component;
readonly attribute RTCIceTransportState state;
readonly attribute RTCIceGathererState gatheringState;
sequence<RTCIceCandidate> getLocalCandidates();
sequence<RTCIceCandidate> getRemoteCandidates();
RTCIceCandidatePair? getSelectedCandidatePair();
RTCIceParameters? getLocalParameters();
RTCIceParameters? getRemoteParameters();
attribute EventHandler onstatechange;
attribute EventHandler ongatheringstatechange;
attribute EventHandler onselectedcandidatepairchange;
};
dictionary RTCIceParameters {
DOMString usernameFragment;
DOMString password;
};
dictionary RTCIceCandidatePair {
RTCIceCandidate local;
RTCIceCandidate remote;
};
enum RTCIceGathererState {
"new",
"gathering",
"complete"
};
enum RTCIceTransportState {
"new",
"checking",
"connected",
"completed",
"disconnected",
"failed",
"closed"
};
enum RTCIceRole {
"unknown",
"controlling",
"controlled"
};
enum RTCIceComponent {
"rtp",
"rtcp"
};
[Exposed=Window]
interface RTCTrackEvent : Event {
constructor(DOMString type, RTCTrackEventInit eventInitDict);
readonly attribute RTCRtpReceiver receiver;
readonly attribute MediaStreamTrack track;
[SameObject] readonly attribute FrozenArray<MediaStream> streams;
readonly attribute RTCRtpTransceiver transceiver;
};
dictionary RTCTrackEventInit : EventInit {
required RTCRtpReceiver receiver;
required MediaStreamTrack track;
sequence<MediaStream> streams = [];
required RTCRtpTransceiver transceiver;
};
partial interface RTCPeerConnection {
readonly attribute RTCSctpTransport? sctp;
RTCDataChannel createDataChannel(USVString label,
optional RTCDataChannelInit dataChannelDict = {});
attribute EventHandler ondatachannel;
};
[Exposed=Window]
interface RTCSctpTransport : EventTarget {
readonly attribute RTCDtlsTransport transport;
readonly attribute RTCSctpTransportState state;
readonly attribute unrestricted double maxMessageSize;
readonly attribute unsigned short? maxChannels;
attribute EventHandler onstatechange;
};
enum RTCSctpTransportState {
"connecting",
"connected",
"closed"
};
[Exposed=Window]
interface RTCDataChannel : EventTarget {
readonly attribute USVString label;
readonly attribute boolean ordered;
readonly attribute unsigned short? maxPacketLifeTime;
readonly attribute unsigned short? maxRetransmits;
readonly attribute USVString protocol;
readonly attribute boolean negotiated;
readonly attribute unsigned short? id;
readonly attribute RTCDataChannelState readyState;
readonly attribute unsigned long bufferedAmount;
[EnforceRange] attribute unsigned long bufferedAmountLowThreshold;
attribute EventHandler onopen;
attribute EventHandler onbufferedamountlow;
attribute EventHandler onerror;
attribute EventHandler onclosing;
attribute EventHandler onclose;
void close();
attribute EventHandler onmessage;
attribute DOMString binaryType;
void send(USVString data);
void send(Blob data);
void send(ArrayBuffer data);
void send(ArrayBufferView data);
};
dictionary RTCDataChannelInit {
boolean ordered = true;
[EnforceRange] unsigned short maxPacketLifeTime;
[EnforceRange] unsigned short maxRetransmits;
USVString protocol = "";
boolean negotiated = false;
[EnforceRange] unsigned short id;
};
enum RTCDataChannelState {
"connecting",
"open",
"closing",
"closed"
};
[Exposed=Window]
interface RTCDataChannelEvent : Event {
constructor(DOMString type, RTCDataChannelEventInit eventInitDict);
readonly attribute RTCDataChannel channel;
};
dictionary RTCDataChannelEventInit : EventInit {
required RTCDataChannel channel;
};
partial interface RTCRtpSender {
readonly attribute RTCDTMFSender? dtmf;
};
[Exposed=Window]
interface RTCDTMFSender : EventTarget {
void insertDTMF(DOMString tones, optional unsigned long duration = 100, optional unsigned long interToneGap = 70);
attribute EventHandler ontonechange;
readonly attribute boolean canInsertDTMF;
readonly attribute DOMString toneBuffer;
};
[Exposed=Window]
interface RTCDTMFToneChangeEvent : Event {
constructor(DOMString type, RTCDTMFToneChangeEventInit eventInitDict);
readonly attribute DOMString tone;
};
dictionary RTCDTMFToneChangeEventInit : EventInit {
required DOMString tone;
};
partial interface RTCPeerConnection {
Promise<RTCStatsReport> getStats(optional MediaStreamTrack? selector = null);
};
[Exposed=Window]
interface RTCStatsReport {
readonly maplike<DOMString, object>;
};
dictionary RTCStats {
required DOMHighResTimeStamp timestamp;
required RTCStatsType type;
required DOMString id;
};
[Exposed=Window]
interface RTCError : DOMException {
constructor(RTCErrorInit init, optional DOMString message = "");
readonly attribute RTCErrorDetailType errorDetail;
readonly attribute long? sdpLineNumber;
readonly attribute long? httpRequestStatusCode;
readonly attribute long? sctpCauseCode;
readonly attribute unsigned long? receivedAlert;
readonly attribute unsigned long? sentAlert;
};
dictionary RTCErrorInit {
required RTCErrorDetailType errorDetail;
long sdpLineNumber;
long httpRequestStatusCode;
long sctpCauseCode;
unsigned long receivedAlert;
unsigned long sentAlert;
};
enum RTCErrorDetailType {
"data-channel-failure",
"dtls-failure",
"fingerprint-failure",
"sctp-failure",
"sdp-syntax-error",
"hardware-encoder-not-available",
"hardware-encoder-error"
};
[Exposed=Window]
interface RTCErrorEvent : Event {
constructor(DOMString type, RTCErrorEventInit eventInitDict);
[SameObject] readonly attribute RTCError error;
};
dictionary RTCErrorEventInit : EventInit {
required RTCError error;
};