diff --git a/samples/js/apprtc/js/main.js b/samples/js/apprtc/js/main.js index 7750ad1b4b..f2f53ab787 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.');