FS-6707 #resolve #comment add the param iceServers to verto constructor. possible values: true: enables previous behaviour, false: nowthe default, use no iceServers, ARRAY of iceServer objects: this object will be passed into the browser as-is

This commit is contained in:
Anthony Minessale
2014-07-31 22:45:47 +05:00
parent 5a7144c44a
commit 40bb7b7b4d
3 changed files with 39 additions and 17 deletions

View File

@@ -76,6 +76,7 @@
useVideo: null,
useStereo: false,
userData: null,
iceServers: false,
videoParams: {},
callbacks: {
onICEComplete: function() {},
@@ -305,6 +306,7 @@
return onChannelError(self, e);
},
constraints: self.constraints,
iceServers: self.options.iceServers,
offerSDP: {
type: "offer",
sdp: self.remoteSDP
@@ -364,7 +366,8 @@
onChannelError: function(e) {
return onChannelError(self, e);
},
constraints: self.constraints
constraints: self.constraints,
iceServers: self.options.iceServers,
});
onStreamSuccess(self);
@@ -418,19 +421,34 @@
credential: 'homeo'
};
var iceServers = {
iceServers: options.iceServers || [STUN]
};
var iceServers = null;
if (!moz && !options.iceServers) {
if (parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2]) >= 28) TURN = {
url: 'turn:turn.bistri.com:80',
credential: 'homeo',
username: 'homeo'
if (options.iceServers) {
var tmp = options.iceServers;;
if (typeof(tmp) === "boolean") {
tmp = null;
}
if (tmp && typeof(tmp) !== "array") {
console.warn("iceServers must be an array, reverting to default ice servers");
tmp = null;
}
iceServers = {
iceServers: tmp || [STUN]
};
iceServers.iceServers = [STUN];
}
if (!moz && !tmp) {
if (parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2]) >= 28) TURN = {
url: 'turn:turn.bistri.com:80',
credential: 'homeo',
username: 'homeo'
};
iceServers.iceServers = [STUN];
}
}
var optional = {
optional: []

View File

@@ -72,6 +72,7 @@
socketUrl: null,
tag: null,
videoParams: {},
iceServers: false,
ringSleep: 6000
},
options);
@@ -1487,6 +1488,7 @@
useAudio: dialog.audioStream,
useStereo: dialog.params.useStereo,
videoParams: verto.options.videoParams,
iceServers: verto.options.iceServers
});
dialog.rtc.verto = dialog.verto;