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
|
---
title: RTCIceServer
slug: Web/API/RTCIceServer
translation_of: Web/API/RTCIceServer
---
<p>{{APIRef("WebRTC")}}</p>
<p>RTCIceServer définit comment se connecter à un serveur ICE unique (comme un serveur {{Glossary("STUN")}} ou {{Glossary("TURN")}}). Il comprend à la fois l'URL et les éventuelle informations d'identification nécessaires pour se connecter au serveur.</p>
<h2 id="Propriétés">Propriétés</h2>
<dl>
<dt>{{domxref("RTCIceServer.credential", "credential")}} {{optional_inline}}</dt>
<dd>Les informations d'identification à utiliser lors de la connexion au serveur. Celles‑ci sont utilisées uniquement si <code>RTCIceServer</code> est un serveur TURN.</dd>
<dt>{{domxref("RTCIceServer.credentialType", "credentialType")}} {{optional_inline}}</dt>
<dd>Si <code>RTCIceServer</code> est un serveur TURN, cet attribut spécifie quel type d'information d'identification doit être utilisé lors de la connexion. Ce doit être l'une des valeurs définies par l'énumération {{domxref("RTCIceCredentialType")}}. La valeur par défaut est <code>password</code>.</dd>
<dt>{{domxref("RTCIceServer.url", "url")}} {{obsolete_inline}}</dt>
<dd>Cette propriété obsolète est une chaîne spécifiant l'URL d'un serveur ICE unique. <strong>Ne pas utiliser cette propriété; utiliser plutôt {{domxref("RTCIceServer.urls")}}</strong>. Étant donné que de nombreux livres et exemples anciens l'utilisent encore, nous l'incluons pour aider les développeurs à mettre à jour leur code ou donner un sens a des exemples plus anciens.</dd>
<dt>{{domxref("RTCIceServer.urls", "urls")}}</dt>
<dd>Cette propriété est <strong>obligatoire</strong>, elle peut être soit une seule {{domxref("DOMString")}} ou un tableau de {{domxref("DOMString")}} , spécifiant chacun une URL qui peut être utilisée pour se connecter au serveur.</dd>
<dt>{{domxref("RTCIceServer.username", "username")}} {{optional_inline}}</dt>
<dd>Si <code>RTCIceServer</code> est un serveur TURN, alors ceci est le nom d'utilisateur à utiliser pendant le processus d'authentification.</dd>
</dl>
<p>Évitez de spécifier un nombre inutilement élevé d'URL dans la propriété <code>urls</code>; le temps de démarrage de votre connexion va augmenter sensiblement. Chaque serveur dans la liste sera contacté et testé avant d'en choisir un pour être utilisé pour la négociation.</p>
<div class="note">
<p>Les anciennes versions de la spécification WebRTC incluent une propriété <code>url</code> au lieu de <code>urls</code>; cela a été changé afin de vous permettre de spécifier plusieurs adresses pour chaque serveur dans la liste, comme le montre l'exemple ci-dessous.</p>
</div>
<h2 id="Constantes">Constantes</h2>
<h3 id="Enumeration_RTCIceCredentialType">Enumeration RTCIceCredentialType </h3>
<p>L'enumeration <code>RTCIceCredentialType</code> spécifie les valeurs qui peuvent être renvoyés par la propriété credentialType pour définir quel type d'authentification est fournie dans la propriété {{domxref("RTCIceServer.credential")}}. Cela peut être l'une des valeurs ci‑dessous.</p>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Constante</th>
<th scope="col">Description</th>
</tr>
<tr>
<td><code>"password"</code></td>
<td>un mot de passe d'aithentification. Voir {{RFC (5389, "", 10.2)}} pour plus de détails.</td>
</tr>
<tr>
<td><code>"token"</code></td>
<td>The credential is an access token to be used with a third-party authentication system.</td>
</tr>
</thead>
</table>
<h2 id="Example">Example</h2>
<p>The configuration below establishes two ICE servers. The first one, <code>stun:stun.services.mozilla.com</code>, requires authentication, so the username and password are provided. The second server has two URLs: <code>stun:stun.example.com</code> and <code>stun:stun-1.example.com</code>.</p>
<pre class="brush: js notranslate">var configuration = { iceServers: [{
urls: "stun:stun.services.mozilla.com",
username: "louis@mozilla.com",
credential: "webrtcdemo"
}, {
urls: [
"stun:stun.example.com",
"stun:stun-1.example.com"
]
}]
};
var pc = new RTCPeerConnection(configuration);</pre>
<p>Once the configuration object has been created, it is passed into the {{domxref("RTCPeerConnection.RTCPeerConnection", "RTCPeerConnection()")}} constructor to use it as the configuration for the new peer connection.</p>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>{{CompatibilityTable}}</div>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari (WebKit)</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatGeckoDesktop(22)}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Android Webview</th>
<th>Firefox Mobile (Gecko)</th>
<th>Firefox OS</th>
<th>IE Mobile</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
<th>Chrome for Android</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatGeckoMobile(24)}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatVersionUnknown}}</td>
</tr>
</tbody>
</table>
</div>
<h2 id="See_also">See also</h2>
<ul>
<li>{{domxref("RTCPeerConnection")}}</li>
<li>{{domxref("RTCConfiguration")}}</li>
<li><a href="/en-US/docs/Web/API/WebRTC_API/Session_lifetime">Lifetime of a WebRTC session</a></li>
<li><a href="/en-US/docs/Web/API/WebRTC_API/Connectivity">WebRTC connectivity</a></li>
</ul>
|