From 5a27e49f355b853160a227365780aaa15d0e7e75 Mon Sep 17 00:00:00 2001
From: "mallinath@webrtc.org"
 <mallinath@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>
Date: Thu, 8 Aug 2013 19:52:08 +0000
Subject: [PATCH] This CL will add support of passing all turn urls returned by
 the CEOD to PeerConnection object.

R=juberti@webrtc.org, vikasmarwaha@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1949004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4506 4adac7df-926f-26a2-2b94-8c16560cd09d
---
 samples/js/apprtc/js/main.js | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/samples/js/apprtc/js/main.js b/samples/js/apprtc/js/main.js
index 7750ad1b4..f2f53ab78 100644
--- a/samples/js/apprtc/js/main.js
+++ b/samples/js/apprtc/js/main.js
@@ -86,11 +86,14 @@
 
     if (xmlhttp.status === 200) {
       var turnServer = JSON.parse(xmlhttp.responseText);
-      // Create a turnUri using the polyfill (adapter.js).
-      var iceServer = createIceServer(turnServer.uris[0], turnServer.username,
-                                      turnServer.password);
-      if (iceServer !== null) {
-        pcConfig.iceServers.push(iceServer);
+      for (i = 0; i < turnServer.uris.length; i++) {
+        // Create a turnUri using the polyfill (adapter.js).
+        var iceServer = createIceServer(turnServer.uris[i],
+                                        turnServer.username,
+                                        turnServer.password);
+        if (iceServer !== null) {
+          pcConfig.iceServers.push(iceServer);
+        }
       }
     } else {
       console.log('Request for TURN server failed.');