Moving creating TURN configration to the host machine instead of the bots - rtcBot
R=andresp@webrtc.org Review URL: https://webrtc-codereview.appspot.com/24939004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7468 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
f7030d4ed7
commit
0371a37f85
@ -113,38 +113,9 @@ function getStreamFromIdentifier_(id) {
|
||||
return null;
|
||||
};
|
||||
|
||||
// Ask computeengineondemand to give us TURN server credentials and URIs.
|
||||
function asyncCreateTurnConfig(onSuccess, onError) {
|
||||
var CEOD_URL = ('https://computeengineondemand.appspot.com/turn?' +
|
||||
'username=1234&key=5678');
|
||||
var xhr = new XMLHttpRequest();
|
||||
function onResult() {
|
||||
if (xhr.readyState != 4)
|
||||
return;
|
||||
|
||||
if (xhr.status != 200) {
|
||||
onError('TURN request failed');
|
||||
return;
|
||||
}
|
||||
|
||||
var response = JSON.parse(xhr.responseText);
|
||||
var iceServer = {
|
||||
'username': response.username,
|
||||
'credential': response.password,
|
||||
'urls': response.uris
|
||||
};
|
||||
onSuccess({ 'iceServers': [ iceServer ] });
|
||||
}
|
||||
|
||||
xhr.onreadystatechange = onResult;
|
||||
xhr.open('GET', CEOD_URL, true);
|
||||
xhr.send();
|
||||
};
|
||||
|
||||
connectToServer({
|
||||
ping: ping,
|
||||
getUserMedia: getUserMedia,
|
||||
createPeerConnection: createPeerConnection,
|
||||
showStream: showStream,
|
||||
asyncCreateTurnConfig: asyncCreateTurnConfig,
|
||||
});
|
||||
|
@ -9,6 +9,7 @@
|
||||
// Provides a Test class that exposes api to the tests.
|
||||
// Read test.prototype to see what methods are exposed.
|
||||
var fs = require('fs');
|
||||
var request = require('request');
|
||||
var BotManager = require('./botmanager.js');
|
||||
|
||||
function Test() {
|
||||
@ -71,6 +72,26 @@ Test.prototype = {
|
||||
createStatisticsReport: function (outputFileName) {
|
||||
return new StatisticsReport(outputFileName);
|
||||
},
|
||||
|
||||
// Ask computeengineondemand to give us TURN server credentials and URIs.
|
||||
createTurnConfig: function (onSuccess, onError) {
|
||||
request('https://computeengineondemand.appspot.com/turn?username=1234&key=5678',
|
||||
function (error, response, body) {
|
||||
if (error || response.statusCode != 200) {
|
||||
onError('TURN request failed');
|
||||
return;
|
||||
}
|
||||
|
||||
var response = JSON.parse(body);
|
||||
var iceServer = {
|
||||
'username': response.username,
|
||||
'credential': response.password,
|
||||
'urls': response.uris
|
||||
};
|
||||
onSuccess({ 'iceServers': [ iceServer ] });
|
||||
}
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
StatisticsReport = function (outputFileName) {
|
||||
|
@ -20,9 +20,11 @@ function testOneWayVideo(test, bot1, bot2) {
|
||||
onPeerConnectionCreated);
|
||||
|
||||
function createPeerConnection(done) {
|
||||
this.asyncCreateTurnConfig(function(config) {
|
||||
test.createTurnConfig(onTrunConfig.bind(this), test.fail);
|
||||
|
||||
function onTurnConfig(config) {
|
||||
this.createPeerConnection(config, done, test.fail);
|
||||
}.bind(this), test.fail);
|
||||
};
|
||||
}
|
||||
|
||||
function onPeerConnectionCreated(pc1, pc2) {
|
||||
|
Loading…
Reference in New Issue
Block a user