- From: Sergio Garcia Murillo via GitHub <sysbot+gh@w3.org>
 - Date: Wed, 13 Apr 2016 07:52:43 +0000
 - To: public-ortc@w3.org
 
murillo128 has just created a new issue for 
https://github.com/openpeer/ortc:
== Wrong usage of RTCIceGatherOptions dictionaries on examples ==
Accroding to WebIDL  definition, directories are  asociative array 
data type with a fixed, ordered set of key–value pairs 
(https://www.w3.org/TR/WebIDL/#idl-dictionaries). The don't have a 
constructor, so in javascript a normal object mus be used when 
creating a dictionary.
But in several examples, for example, the RTCIceGatherOptions is 
created via a constructor (which is wrong).
```javascript
// Create ICE gather options
var gatherOptions = new RTCIceGatherOptions();
gatherOptions.gatherPolicy = RTCIceGatherPolicy.relay;
gatherOptions.iceServers = [
  { urls: "stun:stun1.example.net" },
  { urls: "turn:turn.example.org", username: "user", credential: 
"myPassword", credentialType: "password" }
];
```
It sould be
```
// Create ICE gather options
var gatherOptions = {};
gatherOptions.gatherPolicy = RTCIceGatherPolicy.relay;
gatherOptions.iceServers = [
  { urls: "stun:stun1.example.net" },
  { urls: "turn:turn.example.org", username: "user", credential: 
"myPassword", credentialType: "password" }
];
```
or even better:
```
// Create ICE gather options
var gatherOptions = {
  gatherPolicy : RTCIceGatherPolicy.relay,
  gatherOptions.iceServers : [
    { urls: "stun:stun1.example.net" },
    { urls: "turn:turn.example.org", username: "user", credential: 
"myPassword", credentialType: "password" }
  ]
};
```
Please view or discuss this issue at 
https://github.com/openpeer/ortc/issues/464 using your GitHub account
Received on Wednesday, 13 April 2016 07:52:45 UTC