-
Notifications
You must be signed in to change notification settings - Fork 115
/
webrtc.html
18211 lines (18161 loc) · 817 KB
/
webrtc.html
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
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="webrtc.css" rel="stylesheet">
<title>
WebRTC: Real-Time Communication in Browsers
</title>
<script class="remove" src="respec-w3c-common.js">
// // keep this comment //
</script>
<script class="remove" src="testable-assertions.js">
</script>
<script class="remove" src="js/diff/specdiff.js"></script>
<script class="remove" src="amendments.js">
</script>
<script class="remove" src="webrtc.js">
// // keep this comment //
</script>
<script src="diff.js" defer>
</script>
</head>
<body>
<p class="copyright">
Initial Author of this Specification was Ian Hickson, Google Inc., with
the following copyright statement:<br>
© Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera
Software ASA. You are granted a license to use, reproduce and create
derivative works of this document. All subsequent changes since 26 July
2011 done by the W3C WebRTC Working Group are under the following
<a href="https://www.w3.org/policies/#copyright">Copyright</a>:<br>
<a href="https://www.w3.org/policies/#copyright">Copyright</a> © 2011-2024 <a href="https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://www.w3.org/policies/#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/policies/#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/copyright/software-license/">permissive document license</a> rules apply.</p>
<section id="abstract">
<p>
This document defines a set of ECMAScript APIs in WebIDL to allow media
and generic application data to be sent to and received from another
browser or device implementing the appropriate set of real-time
protocols. This specification is being developed in conjunction with a
protocol specification developed by the IETF RTCWEB group and an API
specification to get access to local media devices.
</p>
</section>
<section id="sotd" class="updateable-rec">
<p><span hidden class="correction addition proposed-correction proposed-addition"></span>This document includes <a href="#proposed-amendments">Proposed Amendments</a> and <a href="#candidate-amendments" >Candidate Amendments</a> to the current <a href="https://www.w3.org/TR/2021/REC-webrtc-20210126/">W3C Recommendation dated January 26, 2021</a>.</p>
<p>
Its <a href=
"https://github.com/web-platform-tests/wpt/tree/master/webrtc">associated
test suite</a> has been used to build an <a href=
"https://w3c.github.io/webrtc-interop-reports/webrtc-pc-report.html">implementation
report</a> of the API at the time of its initial publication as a Recommendation. That test suite has been updated to integrate most of the amendments, and an <a href="https://www.w3.org/2024/10/webrtc-amendments-interop.html">updated implementation report</a> focused on the implementation status of these amendments has been used to select features with double implementation as proposed amendments.</p>
</p>
</section>
<section class="informative" id="intro">
<h2>
Introduction
</h2>
<p>
There are a number of facets to peer-to-peer communications and
video-conferencing in HTML covered by this specification:
</p>
<ul>
<li>Connecting to remote peers using NAT-traversal technologies such as
ICE, STUN, and TURN.
</li>
<li>Sending the locally-produced tracks to remote peers and receiving
tracks from remote peers.
</li>
<li>Sending arbitrary data directly to remote peers.
</li>
</ul>
<p>
This document defines the APIs used for these features. This
specification is being developed in conjunction with a protocol
specification developed by the <a href=
"https://datatracker.ietf.org/wg/rtcweb/">IETF RTCWEB group</a> and an
API specification to get access to local media devices [[GETUSERMEDIA]]
developed by the WebRTC Working Group. An overview of the system can be
found in [[RFC8825]] and [[RFC8826]].
</p>
</section>
<section id="conformance">
<p>
This specification defines conformance criteria that apply to a single
product: the <dfn>user agent</dfn> that implements the interfaces that
it contains.
</p>
<p>
Conformance requirements phrased as algorithms or specific steps may be
implemented in any manner, so long as the end result is equivalent. (In
particular, the algorithms defined in this specification are intended
to be easy to follow, and not intended to be performant.)
</p>
<p>
Implementations that use ECMAScript to implement the APIs defined in
this specification MUST implement them in a manner consistent with the
ECMAScript Bindings defined in the Web IDL specification [[!WEBIDL]],
as this specification uses that specification and terminology.
</p>
</section>
<section>
<h2>
Terminology
</h2>
<p>
The {{EventHandler}} interface, representing a callback used for event
handlers, is defined in [[!HTML]].
</p>
<p>
The concepts [= queue a task =] and [= networking task source =] are
defined in [[!HTML]].
</p>
<p>
The concept [= fire an event =] is defined in [[!DOM]].
</p>
<p>
The terms [= event =], [= event handlers =] and [= event handler event
types =] are defined in [[!HTML]].
</p>
<p>
{{Performance.timeOrigin}} and {{Performance.now()}} are defined in
[[!hr-time]].
</p>
<p>
The terms <dfn class=fixme data-cite="HTML/structured-data.html#serializable-objects">serializable objects</dfn>, [= serialization steps =], and [=
deserialization steps =] are defined in [[!HTML]].
</p>
<p>
The terms {{MediaStream}}, {{MediaStreamTrack}}, and
{{MediaStreamConstraints}} are defined in [[!GETUSERMEDIA]]. Note that
{{MediaStream}} is extended in <a href="#mediastream-network-use"></a>
in this document while {{MediaStreamTrack}} is extended in <a href=
"#mediastreamtrack-network-use"></a> in this document.
</p>
<p>
The term {{Blob}} is defined in [[!FILEAPI]].
</p>
<p>
The term <dfn>media description</dfn> is defined in [[!RFC4566]].
</p>
<p>
The term <dfn>media transport</dfn> is defined in [[!RFC7656]].
</p>
<p>
The term <dfn>generation</dfn> is defined in [[RFC8838]] Section
2.
</p>
<p>
The terms <dfn data-cite="!WEBRTC-STATS#dfn-stats-object">stats
object</dfn> and <dfn data-cite=
"!WEBRTC-STATS#dfn-monitored-object">monitored object</dfn> are defined
in [[!WEBRTC-STATS]].
</p>
<p>
When referring to exceptions, the terms [= exception/throw =] and [=
exception/created =] are defined in [[!WEBIDL]].
</p>
<p>
The callback {{VoidFunction}} is defined in [[!WEBIDL]].
</p>
<p>
The term "throw" is used as specified in [[!INFRA]]: it terminates the
current processing steps.
</p>
<p>
The terms <dfn data-lt="fulfill|fulfillment">fulfilled</dfn>,
<dfn data-lt="reject|rejection|rejecting">rejected</dfn>, <dfn data-lt=
"resolve|resolves">resolved</dfn>, and
<dfn>settled</dfn> used in the context of Promises are defined in
[[!ECMASCRIPT-6.0]].
</p>
<p>
The <dfn data-cite=
"WebCryptoAPI/#dfn-AlgorithmIdentifier">AlgorithmIdentifier</dfn> is
defined in [[!WebCryptoAPI]].
</p>
<p class="note">
The general principles for Javascript APIs apply, including the
principle of <a href=
"https://w3ctag.github.io/design-principles/#js-rtc">run-to-completion</a>
and no-data-races as defined in [[API-DESIGN-PRINCIPLES]]. That is,
while a task is running, external events do not influence what's
visible to the Javascript application. For example, the amount of data
buffered on a data channel will increase due to "send" calls while
Javascript is executing, and the decrease due to packets being sent
will be visible after a task checkpoint.<br>
It is the responsibility of the user agent to make sure the set of
values presented to the application is consistent - for instance that
getContributingSources() (which is synchronous) returns values for all
sources measured at the same time.
</p>
</section>
<section>
<h2>
Peer-to-peer connections
</h2>
<section class=informative>
<h3>
Introduction
</h3>
<p data-tests="RTCPeerConnection-remote-track-mute.https.html">
An {{RTCPeerConnection}} instance allows an application to establish
peer-to-peer communications with another {{RTCPeerConnection}}
instance in another browser, or to another endpoint implementing the
required protocols. Communications are coordinated by the exchange of
control messages (called a signaling protocol) over a signaling
channel which is provided by unspecified means, but generally by a
script in the page via the server, e.g. using {{WebSocket}} or
{{XMLHttpRequest}}.
</p>
</section>
<section>
<h3>
Configuration
</h3>
<section id="rtcconfiguration-dictionary">
<h4>
<dfn>RTCConfiguration</dfn> Dictionary
</h4>
<p>
The {{RTCConfiguration}} defines a set of parameters to configure
how the peer-to-peer communication established via
{{RTCPeerConnection}} is established or re-established.
</p>
<div>
<pre class="idl">dictionary RTCConfiguration {
sequence<RTCIceServer> iceServers = [];
RTCIceTransportPolicy iceTransportPolicy = "all";
RTCBundlePolicy bundlePolicy = "balanced";
RTCRtcpMuxPolicy rtcpMuxPolicy = "require";
sequence<RTCCertificate> certificates = [];
[EnforceRange] octet iceCandidatePoolSize = 0;
};</pre>
<section id="dictionary-rtcconfiguration-members">
<h2>
Dictionary {{RTCConfiguration}} Members
</h2>
<dl data-link-for="RTCConfiguration" data-dfn-for=
"RTCConfiguration" class="dictionary-members">
<dt data-tests="RTCConfiguration-iceServers.html">
<dfn data-idl="">iceServers</dfn> of type <span class=
"idlMemberType">sequence<{{RTCIceServer}}></span>,
defaulting to <code>[]</code>.
</dt>
<dd>
<p>
An array of objects describing servers available to be used
by ICE, such as STUN and TURN servers.
If the number of ICE servers exceeds an
implementation-defined limit, ignore the ICE servers above
the threshold. This implementation defined limit MUST be
at least 32.
</p>
</dd>
<dt data-tests="RTCConfiguration-iceTransportPolicy.html">
<dfn data-idl="">iceTransportPolicy</dfn> of type
<span class="idlMemberType">{{RTCIceTransportPolicy}}</span>,
defaulting to <code>"all"</code>.
</dt>
<dd>
<p>
Indicates which candidates the [= ICE Agent =] is allowed
to use.
</p>
</dd>
<dt data-tests=
"RTCConfiguration-bundlePolicy.html,RTCPeerConnection-iceConnectionState.https.html">
<dfn data-idl="">bundlePolicy</dfn> of type <span class=
"idlMemberType">{{RTCBundlePolicy}}</span>, defaulting to
<code>"balanced"</code>.
</dt>
<dd>
<p>
Indicates which <a data-lt="RTCBundlePolicy">media-bundling
policy</a> to use when gathering ICE candidates.
</p>
</dd>
<dt data-tests="RTCConfiguration-rtcpMuxPolicy.html">
<dfn data-idl="">rtcpMuxPolicy</dfn> of type <span class=
"idlMemberType">{{RTCRtcpMuxPolicy}}</span>, defaulting to
<code>"require"</code>.
</dt>
<dd>
<p>
Indicates which <a data-lt="RTCRtcpMuxPolicy">rtcp-mux
policy</a> to use when gathering ICE candidates.
</p>
</dd>
<dt data-tests=
"RTCPeerConnection-constructor.html,RTCCertificate.html">
<dfn data-idl="">certificates</dfn> of type <span class=
"idlMemberType">sequence<{{RTCCertificate}}></span>,
defaulting to <code>[]</code>.
</dt>
<dd>
<p>
A set of certificates that the {{RTCPeerConnection}} uses
to authenticate.
</p>
<p>
Valid values for this parameter are created through calls
to the {{RTCPeerConnection/generateCertificate()}}
function.
</p>
<p>
Although any given DTLS connection will use only one
certificate, this attribute allows the caller to provide
multiple certificates that support different algorithms.
The final certificate will be selected based on the DTLS
handshake, which establishes which certificates are
allowed. The {{RTCPeerConnection}} implementation selects
which of the certificates is used for a given connection;
how certificates are selected is outside the scope of this
specification.
</p>
<p class="note">
Existing implementations only utilize the first certificate
provided; the others are ignored.
</p>
<p>
If this value is absent, then a default set of certificates
is generated for each {{RTCPeerConnection}} instance.
</p>
<p>
This option allows applications to establish key
continuity. An {{RTCCertificate}} can be persisted in
[[?INDEXEDDB]] and reused. Persistence and reuse also
avoids the cost of key generation.
</p>
<p>
The value for this configuration option cannot change after
its value is initially selected.
</p>
</dd>
<dt data-tests=
"RTCPeerConnection-constructor.html,RTCConfiguration-iceCandidatePoolSize.html">
<dfn data-idl="">iceCandidatePoolSize</dfn> of type
<span class="idlMemberType">octet</span>, defaulting to
<code>0</code>
</dt>
<dd>
<p>
Size of the prefetched ICE pool as defined in
<span data-jsep=
"ice-candidate-pool pc-constructor">[[!RFC9429]]</span>.
</p>
</dd>
</dl>
</section>
</div>
</section>
<div id="rtcicecredentialtype-enum" class="diff-rm"><!-- Keep for candidate amendments management --></div>
<section id="rtciceserver-dictionary">
<h4>
<dfn>RTCIceServer</dfn> Dictionary
</h4>
<p>
The {{RTCIceServer}} dictionary is used to describe the STUN and
TURN servers that can be used by the [= ICE Agent =] to establish a
connection with a peer.
</p>
<div>
<pre class="idl">dictionary RTCIceServer {
required (DOMString or sequence<DOMString>) urls;
DOMString username;
DOMString credential;
};</pre>
<section>
<h2>
Dictionary {{RTCIceServer}} Members
</h2>
<dl data-link-for="RTCIceServer" data-dfn-for="RTCIceServer"
class="dictionary-members">
<dt data-tests="RTCConfiguration-iceServers.html">
<dfn data-idl="">urls</dfn> of type <span class=
"idlMemberType">(DOMString or
sequence<DOMString>)</span>, required
</dt>
<dd>
<p>
STUN or TURN URI(s) as defined in [[!RFC7064]] and
[[!RFC7065]] or other URI types.
</p>
</dd>
<dt data-tests="RTCConfiguration-iceServers.html">
<dfn data-idl="">username</dfn> of type <span class=
"idlMemberType">DOMString</span>
</dt>
<dd>
<p>
If this {{RTCIceServer}} object represents a TURN server,
then this attribute specifies the username to use with
that TURN server.
</p>
</dd>
<dt data-tests="RTCConfiguration-iceServers.html">
<dfn data-idl="">credential</dfn> of type {{DOMString}}
</dt>
<dd>
<p>
If this {{RTCIceServer}} object represents a TURN server,
then this attribute specifies the credential to use with
that TURN server.
</p>
<p>
{{credential}} represents a long-term authentication
password, as described in [[!RFC5389]], Section 10.2.
</p>
</dd>
</dl>
</section>
</div>
<p>
An example array of {{RTCIceServer}} objects is:
</p>
<pre class="example highlight">
[
{urls: 'stun:stun1.example.net'},
{urls: ['turns:turn.example.org', 'turn:turn.example.net'],
username: 'user',
credential: 'myPassword',
];
</pre>
</section>
<section data-tests="RTCConfiguration-iceTransportPolicy.html">
<h4>
<dfn>RTCIceTransportPolicy</dfn> Enum
</h4>
<p>
As described in <span data-jsep="pc-constructor">[[!RFC9429]]</span>, if
the {{RTCConfiguration/iceTransportPolicy}} member of the
{{RTCConfiguration}} is specified, it defines the <span data-jsep=
"ice-candidate-policy">ICE candidate policy [[!RFC9429]]</span> the
browser uses to surface the permitted candidates to the
application; only these candidates will be used for connectivity
checks.
</p>
<div>
<pre class="idl">enum RTCIceTransportPolicy {
"relay",
"all"
};</pre>
<table data-link-for="RTCIceTransportPolicy" data-dfn-for=
"RTCIceTransportPolicy" class="simple">
<caption>{{RTCIceTransportPolicy}} Enumeration description</caption>
<thead>
<tr>
<th>Enum value</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<dfn data-idl="">relay</dfn>
</td>
<td>
<p>
The [= ICE Agent =] uses only media relay candidates such
as candidates passing through a TURN server.
</p>
<div class="note">
This can be used to prevent the remote endpoint from
learning the user's IP addresses, which may be desired in
certain use cases. For example, in a "call"-based
application, the application may want to prevent an
unknown caller from learning the callee's IP addresses
until the callee has consented in some way.
</div>
</td>
</tr>
<tr>
<td>
<dfn data-idl="">all</dfn>
</td>
<td>
<p>
The [= ICE Agent =] can use any type of candidate when
this value is specified.
</p>
<div class="note">
The implementation can still use its own candidate
filtering policy in order to limit the IP addresses
exposed to the application, as noted in the description
of {{RTCIceCandidate}}.{{RTCIceCandidate/address}}.
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section data-tests="RTCConfiguration-bundlePolicy.html">
<h4>
<dfn>RTCBundlePolicy</dfn> Enum
</h4>
<p>
As described in <span data-jsep="pc-constructor">[[!RFC9429]]</span>,
bundle policy affects which media tracks are negotiated if the
remote endpoint is not bundle-aware, and what ICE candidates are
gathered. If the remote endpoint is bundle-aware, all media tracks
and data channels are bundled onto the same transport.
</p>
<div>
<pre id="target-bundle-policy" class="idl">enum RTCBundlePolicy {
"balanced",
"max-compat",
"max-bundle"
};</pre>
<table data-link-for="RTCBundlePolicy" data-dfn-for=
"RTCBundlePolicy" class="simple">
<caption>{{RTCBundlePolicy}} Enumeration description</caption>
<thead>
<tr>
<th>Enum value</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td data-tests=
"RTCRtpSender-transport.https.html,RTCPeerConnection-iceConnectionState.https.html">
<dfn data-idl="">balanced</dfn>
</td>
<td>
Gather ICE candidates for each media type in use (audio,
video, and data). If the remote endpoint is not
bundle-aware, negotiate only one audio and video track on
separate transports.
</td>
</tr>
<tr>
<td data-tests=
"RTCRtpSender-transport.https.html,RTCPeerConnection-iceConnectionState.https.html">
<dfn data-idl="">max-compat</dfn>
</td>
<td>
Gather ICE candidates for each track. If the remote
endpoint is not bundle-aware, negotiate all media tracks on
separate transports.
</td>
</tr>
<tr>
<td data-tests=
"RTCRtpSender-transport.https.html,RTCPeerConnection-iceConnectionState.https.html">
<dfn data-idl="">max-bundle</dfn>
</td>
<td>
Gather ICE candidates for only one track. If the remote
endpoint is not bundle-aware, negotiate only one media
track.
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section data-tests="RTCConfiguration-rtcpMuxPolicy.html">
<h4>
<dfn>RTCRtcpMuxPolicy</dfn> Enum
</h4>
<p>
As described in <span data-jsep="pc-constructor">[[!RFC9429]]</span>, the
{{RTCRtcpMuxPolicy}} affects what ICE candidates are gathered to
support non-multiplexed RTCP. The only value defined in this spec
is {{RTCRtcpMuxPolicy/"require"}}.
</p>
<div>
<pre id="target-rtcp-mux-policy" class="idl">
enum RTCRtcpMuxPolicy {
"require"
};
</pre>
<table data-link-for="RTCRtcpMuxPolicy" data-dfn-for=
"RTCRtcpMuxPolicy" class="simple">
<caption>{{RTCRtcpMuxPolicy}} Enumeration description</caption>
<thead>
<tr>
<th>Enum value</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<dfn data-idl="">require</dfn>
</td>
<td>
Gather ICE candidates only for RTP and multiplex RTCP on
the RTP candidates. If the remote endpoint is not capable
of rtcp-mux, session negotiation will fail.
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section>
<h4>
Offer/Answer Options
</h4>
<p>
These dictionaries describe the options that can be used to control
the offer/answer creation process.
</p>
<div>
<pre class="idl">dictionary RTCOfferAnswerOptions {};</pre>
<section>
<h2>
Dictionary <dfn>RTCOfferAnswerOptions</dfn> Members
</h2>
<dl data-link-for="RTCOfferAnswerOptions" data-dfn-for=
"RTCOfferAnswerOptions" class="dictionary-members"></dl>
</section>
</div>
<div>
<pre class="idl">dictionary RTCOfferOptions : RTCOfferAnswerOptions {
boolean iceRestart = false;
};</pre>
<section>
<h2>
Dictionary <dfn>RTCOfferOptions</dfn> Members
</h2>
<dl data-link-for="RTCOfferOptions" data-dfn-for=
"RTCOfferOptions" class="dictionary-members">
<dt data-tests="RTCPeerConnection-restartIce.https.html">
<dfn data-idl="">iceRestart</dfn> of type <span class=
"idlMemberType">boolean</span>, defaulting to
<code>false</code>
</dt>
<dd>
<p>
When the value of this dictionary member is
<code>true</code>, or the relevant {{RTCPeerConnection}}
object's {{RTCPeerConnection/[[LocalIceCredentialsToReplace]]}} slot is
not empty, then the generated description will have ICE
credentials that are different from the current credentials
(as visible in the
{{RTCPeerConnection/currentLocalDescription}} attribute's
SDP). Applying the generated description will restart ICE,
as described in section 9.1.1.1 of [[RFC5245]].
</p>
<p>
When the value of this dictionary member is
<code>false</code>, and the relevant {{RTCPeerConnection}}
object's {{RTCPeerConnection/[[LocalIceCredentialsToReplace]]}} slot is
empty, and the
{{RTCPeerConnection/currentLocalDescription}} attribute has
valid ICE credentials, then the generated description will
have the same ICE credentials as the current value from the
{{RTCPeerConnection/currentLocalDescription}} attribute.
</p>
<p class="note">
Performing an ICE restart is recommended when
{{RTCPeerConnection/iceConnectionState}} transitions to
{{RTCIceConnectionState/"failed"}}. An application may
additionally choose to listen for the
{{RTCPeerConnection/iceConnectionState}} transition to
{{RTCIceConnectionState/"disconnected"}} and then use other
sources of information (such as using
{{RTCPeerConnection/getStats}} to measure if the number of
bytes sent or received over the next couple of seconds
increases) to determine whether an ICE restart is
advisable.
</p>
</dd>
</dl>
</section>
</div>
<div>
<p>
The <dfn>RTCAnswerOptions</dfn> dictionary describe options
specific to session description of type {{RTCSdpType/"answer"}}
(none in this version of the specification).
</p>
<pre class="idl">dictionary RTCAnswerOptions : RTCOfferAnswerOptions {};</pre>
</div>
</section>
</section>
<section>
<h3>
State Definitions
</h3>
<section>
<h4>
<dfn>RTCSignalingState</dfn> Enum
</h4>
<div>
<pre class="idl">enum RTCSignalingState {
"stable",
"have-local-offer",
"have-remote-offer",
"have-local-pranswer",
"have-remote-pranswer",
"closed"
};</pre>
<table data-link-for="RTCSignalingState" data-dfn-for=
"RTCSignalingState" class="simple">
<caption>{{RTCSignalingState}} Enumeration description</caption>
<thead>
<tr>
<th>Enum value</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td data-tests=
"RTCPeerConnection-onsignalingstatechanged.https.html,RTCPeerConnection-setRemoteDescription.html">
<dfn data-idl="">stable</dfn>
</td>
<td>
There is no offer/answer exchange in progress. This is also
the initial state, in which case the local and remote
descriptions are empty.
</td>
</tr>
<tr>
<td data-tests=
"RTCPeerConnection-createOffer.html, RTCPeerConnection-setLocalDescription-offer.html,RTCPeerConnection-setLocalDescription.html,RTCPeerConnection-setRemoteDescription.html">
<dfn data-idl="">have-local-offer</dfn>
</td>
<td>
A local description, of type {{RTCSdpType/"offer"}}, has
been successfully applied.
</td>
</tr>
<tr>
<td data-tests=
"RTCPeerConnection-setLocalDescription-answer.html,RTCPeerConnection-setRemoteDescription-offer.html,RTCPeerConnection-setRemoteDescription-rollback.html,RTCPeerConnection-setRemoteDescription.html">
<dfn data-idl="">have-remote-offer</dfn>
</td>
<td>
A remote description, of type {{RTCSdpType/"offer"}}, has
been successfully applied.
</td>
</tr>
<tr>
<td data-tests=
"RTCPeerConnection-setLocalDescription-pranswer.html">
<dfn data-idl="">have-local-pranswer</dfn>
</td>
<td>
A remote description of type {{RTCSdpType/"offer"}} has
been successfully applied and a local description of type
{{RTCSdpType/"pranswer"}} has been successfully applied.
</td>
</tr>
<tr>
<td data-tests=
"RTCPeerConnection-setRemoteDescription-pranswer.html">
<dfn data-idl="">have-remote-pranswer</dfn>
</td>
<td>
A local description of type {{RTCSdpType/"offer"}} has been
successfully applied and a remote description of type
{{RTCSdpType/"pranswer"}} has been successfully applied.
</td>
</tr>
<tr>
<td data-tests=
"RTCPeerConnection-onsignalingstatechanged.https.html">
<dfn data-idl="">closed</dfn>
</td>
<td>
The {{RTCPeerConnection}} has been closed; its
{{RTCPeerConnection/[[IsClosed]]}} slot is <code>true</code>.
</td>
</tr>
</tbody>
</table>
</div>
<figure>
<img alt="signaling state transition diagram" src=
"images/peerstates.svg" width="600">
<figcaption>
Non-normative signaling state transitions diagram. Method calls
abbreviated.
</figcaption>
</figure>
<p>
An example set of transitions might be:
</p>
<dl>
<dt>
Caller transition:
</dt>
<dd>
<ul>
<li>new RTCPeerConnection(): {{RTCSignalingState/"stable"}}
</li>
<li>setLocalDescription(offer):
{{RTCSignalingState/"have-local-offer"}}
</li>
<li>setRemoteDescription(pranswer):
{{RTCSignalingState/"have-remote-pranswer"}}
</li>
<li>setRemoteDescription(answer):
{{RTCSignalingState/"stable"}}
</li>
</ul>
</dd>
<dt>
Callee transition:
</dt>
<dd>
<ul>
<li>new RTCPeerConnection(): {{RTCSignalingState/"stable"}}
</li>
<li>setRemoteDescription(offer):
{{RTCSignalingState/"have-remote-offer"}}
</li>
<li>setLocalDescription(pranswer):
{{RTCSignalingState/"have-local-pranswer"}}
</li>
<li>setLocalDescription(answer): {{RTCSignalingState/"stable"}}
</li>
</ul>
</dd>
</dl>
</section>
<section>
<h4>
<dfn>RTCIceGatheringState</dfn> Enum
</h4>
<div>
<pre class="idl">enum RTCIceGatheringState {
"new",
"gathering",
"complete"
};</pre>
<div id="rtcicegatheringstate-description">
<table data-link-for="RTCIceGatheringState" data-dfn-for=
"RTCIceGatheringState" class="simple">
<caption>{{RTCIceGatheringState}} Enumeration description</caption>
<thead>
<tr>
<th>Enum value</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td data-tests="RTCPeerConnection-iceGatheringState.html">
<dfn data-idl="">new</dfn>
</td>
<td>
Any of the {{RTCIceTransport}}s are in the
{{RTCIceGathererState/"new"}} gathering state and none of
the transports are in the
{{RTCIceGathererState/"gathering"}} state, or there are no
transports.
</td>
</tr>
<tr>
<td data-tests="RTCPeerConnection-iceGatheringState.html">
<dfn data-idl="">gathering</dfn>
</td>
<td>
Any of the {{RTCIceTransport}}s are in the
{{RTCIceGathererState/"gathering"}} state.
</td>
</tr>
<tr>
<td data-tests=
"RTCPeerConnection-iceGatheringState.html,protocol/candidate-exchange.https.html">
<dfn data-idl="">complete</dfn>
</td>
<td>
At least one {{RTCIceTransport}} exists, and all
{{RTCIceTransport}}s are in the
{{RTCIceGathererState/"complete"}} gathering state.
</td>
</tr>
</tbody>
</table>
<p id="rtcicegatheringstate-transports">
The set of transports considered is the one
presently referenced by the {{RTCPeerConnection}}'s
[= set of transceivers =] and the {{RTCPeerConnection}}'s
{{RTCPeerConnection/[[SctpTransport]]}}
internal slot if not <code>null</code>.
</p>
</div>
</div>
</section>
<section>
<h4>
<dfn>RTCPeerConnectionState</dfn> Enum
</h4>
<div>
<pre class="idl">enum RTCPeerConnectionState {
"closed",
"failed",
"disconnected",
"new",
"connecting",
"connected"
};</pre>
<div id="rtcpeerconnectionstate-description">
<table data-link-for="RTCPeerConnectionState" data-dfn-for=
"RTCPeerConnectionState" class="simple">
<caption>{{RTCPeerConnectionState}} Enumeration description</caption>
<thead>
<tr>
<th>Enum value</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td data-tests=
"RTCPeerConnection-connectionState.https.html">
<dfn data-idl="">closed</dfn>
</td>
<td>
{{RTCPeerConnection/[[IceConnectionState]]}} is
{{RTCIceConnectionState/"closed"}}.
</td>
</tr>
<tr>
<td data-tests="protocol/dtls-fingerprint-validation.html">
<dfn data-idl="">failed</dfn>
</td>
<td>
The previous state doesn't apply, and either
{{RTCPeerConnection/[[IceConnectionState]]}} is
{{RTCIceConnectionState/"failed"}} or any
{{RTCDtlsTransport}}s are in the
{{RTCDtlsTransportState/"failed"}} state.
</td>
</tr>
<tr>
<td data-tests="">
<dfn data-idl="">disconnected</dfn>
</td>
<td>
None of the previous states apply, and
{{RTCPeerConnection/[[IceConnectionState]]}} is
{{RTCIceConnectionState/"disconnected"}}.
</td>
</tr>
<tr>
<td data-tests=
"RTCPeerConnection-connectionState.https.html">
<dfn data-idl="">new</dfn>
</td>
<td>
None of the previous states apply, and either
{{RTCPeerConnection/[[IceConnectionState]]}} is
{{RTCIceConnectionState/"new"}}, and all
{{RTCDtlsTransport}}s are in the
{{RTCDtlsTransportState/"new"}} or
{{RTCDtlsTransportState/"closed"}} state, or there are no
transports.
</td>
</tr>
<tr>
<td data-tests=
"RTCPeerConnection-connectionState.https.html">
<dfn data-idl="">connected</dfn>
</td>
<td>
None of the previous states apply,
{{RTCPeerConnection/[[IceConnectionState]]}} is
{{RTCIceConnectionState/"connected"}}, and all
{{RTCDtlsTransport}}s are in the
{{RTCDtlsTransportState/"connected"}} or
{{RTCDtlsTransportState/"closed"}} state.
</td>
</tr>
<tr>
<td data-tests=
"RTCPeerConnection-connectionState.https.html">
<dfn data-idl="">connecting</dfn>
</td>
<td>
None of the previous states apply.
</td>
</tr>
</tbody>
</table>
<p class="note">
In the {{RTCPeerConnectionState/"connecting"}} state, one or more
{{RTCIceTransport}}s are in the {{RTCIceTransportState/"new"}}
or {{RTCIceTransportState/"checking"}} state, or one or more
{{RTCDtlsTransport}}s are in the {{RTCDtlsTransportState/"new"}}
or {{RTCDtlsTransportState/"connecting"}} state.
</p>
<p>
<p>
The set of transports considered is the one
presently referenced by the {{RTCPeerConnection}}'s
[= set of transceivers =] and the {{RTCPeerConnection}}'s
{{RTCPeerConnection/[[SctpTransport]]}}
internal slot if not <code>null</code>.
</p>
</div>
</div>
</section>
<section>
<h4>
<dfn>RTCIceConnectionState</dfn> Enum
</h4>
<div>