forked from webrtc/samples
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trickle-ice case modified for url structure test when iceserver creat…
…ion and extra file delected
- Loading branch information
Lewis
authored and
Lewis
committed
Jan 27, 2015
1 parent
aa2fe4d
commit b8e0c3b
Showing
3 changed files
with
37 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,20 +10,45 @@ var candidateTBody = document.getElementById('candidatesBody'); | |
var gatherButton = document.getElementById('gather'); | ||
var passwordInput = document.getElementById('password'); | ||
var removeButton = document.getElementById('remove'); | ||
var changeButton = document.getElementById('changeStruct'); | ||
var servers = document.getElementById('servers'); | ||
var urlInput = document.getElementById('url'); | ||
var usernameInput = document.getElementById('username'); | ||
var ipv6Check = document.getElementById('ipv6'); | ||
var unbundleCheck = document.getElementById('unbundle'); | ||
var output = document.getElementById('output'); | ||
|
||
|
||
addButton.onclick = addServer; | ||
gatherButton.onclick = start; | ||
removeButton.onclick = removeServer; | ||
changeButton.onclick = changeStruct; | ||
|
||
var begin, pc; | ||
|
||
var changed = false; | ||
This comment has been minimized.
Sorry, something went wrong.
johache
|
||
|
||
function changeStruct(){ | ||
if(!changed){ | ||
for(var i = servers.options.length - 1; i>=0; --i) { | ||
var sers = JSON.parse(servers[i].value); | ||
if(typeof sers.url === "string"){ | ||
servers[i].value = servers[i].value.replace("\":\"", "\":[\""); | ||
servers[i].value = servers[i].value.replace("\",", "\"],"); | ||
servers[i].text = '[' + servers[i].text + ']'; | ||
} | ||
} | ||
changed = !changed; | ||
}else{ | ||
for(var i = servers.options.length - 1; i>=0; --i) { | ||
var sers = JSON.parse(servers[i].value); | ||
if(sers.url.length === 1 ){ | ||
servers[i].value = servers[i].value.replace("\":[\"", "\":\""); | ||
servers[i].value = servers[i].value.replace("\"],", "\","); | ||
servers[i].text = servers[i].text.substr(1, servers[i].text.length - 2); | ||
} | ||
} | ||
changed = !changed; | ||
} | ||
} | ||
function addServer() { | ||
var scheme = urlInput.value.split(':')[0]; | ||
if (scheme !== 'stun' && scheme !== 'turn' && scheme !== 'turns') { | ||
|
@@ -35,7 +60,11 @@ function addServer() { | |
var option = document.createElement('option'); | ||
var iceServer = createIceServer(urlInput.value, usernameInput.value, passwordInput.value); | ||
option.value = JSON.stringify(iceServer); | ||
option.text = urlInput.value + ' '; | ||
if(changed){ | ||
option.text = '[' + urlInput.value + '] '; | ||
}else{ | ||
option.text = urlInput.value + ' '; | ||
} | ||
var username = usernameInput.value; | ||
var password = passwordInput.value; | ||
if (username || password) { | ||
|
@@ -78,7 +107,7 @@ function start() { | |
// Create a PeerConnection with no streams, but force a m=audio line. | ||
// This will gather candidates for either 1 or 2 ICE components, depending | ||
// on whether the unbundle RTCP checkbox is checked. | ||
var config = {"iceServers": iceServers }; | ||
var config = {"iceServers":iceServers}; | ||
var pcConstraints = {"mandatory": {"IceTransports": iceTransports}}; | ||
var offerConstraints = {"mandatory": {"OfferToReceiveAudio": true}}; | ||
// Whether we gather IPv6 candidates. | ||
|
This file was deleted.
Oops, something went wrong.
I believe hasCredentials is automatically set from the Adapter and it should not be set here