openvidu-browser: iceServers conf extended (stun, turn and turn with tcp transport)

pull/88/merge
pabloFuente 2018-06-25 11:43:48 +02:00
parent e4e7ba6c2d
commit f006965fd2
3 changed files with 8 additions and 4 deletions

View File

@ -59,7 +59,7 @@ export class OpenVidu {
/** /**
* @hidden * @hidden
*/ */
turnCredentials: RTCIceServer; iceServers: RTCIceServer[];
/** /**
* @hidden * @hidden
*/ */

View File

@ -945,9 +945,13 @@ export class Session implements EventDispatcher {
this.openvidu.recorder = true; this.openvidu.recorder = true;
} }
if (!!turnUsername && !!turnCredential) { if (!!turnUsername && !!turnCredential) {
const stunUrl = 'stun:' + url.hostname + ':3478';
const turnUrl1 = 'turn:' + url.hostname + ':3478'; const turnUrl1 = 'turn:' + url.hostname + ':3478';
const turnUrl2 = turnUrl1 + '?transport=tcp'; const turnUrl2 = turnUrl1 + '?transport=tcp';
this.openvidu.turnCredentials = { urls: [turnUrl1, turnUrl2], username: turnUsername, credential: turnCredential }; this.openvidu.iceServers = [
{ urls: [stunUrl] },
{ urls: [turnUrl1, turnUrl2], username: turnUsername, credential: turnCredential }
];
console.log('TURN temp credentials [' + turnUsername + ':' + turnCredential + ']') console.log('TURN temp credentials [' + turnUsername + ':' + turnCredential + ']')
} }
if (!!role) { if (!!role) {

View File

@ -530,8 +530,8 @@ export class Stream {
returnValue = this.session.openvidu.advancedConfiguration.iceServers === 'freeice' ? returnValue = this.session.openvidu.advancedConfiguration.iceServers === 'freeice' ?
undefined : undefined :
this.session.openvidu.advancedConfiguration.iceServers; this.session.openvidu.advancedConfiguration.iceServers;
} else if (this.session.openvidu.turnCredentials) { } else if (this.session.openvidu.iceServers) {
returnValue = [this.session.openvidu.turnCredentials]; returnValue = this.session.openvidu.iceServers;
} else { } else {
returnValue = undefined; returnValue = undefined;
} }