Update adapter.js to use TURN transport parameters for FF version 27 & above.
R=juberti@google.com Review URL: https://webrtc-codereview.appspot.com/2829004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5031 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
d674a566d3
commit
442c5e47cd
@ -41,15 +41,24 @@ if (navigator.mozGetUserMedia) {
|
|||||||
if (url_parts[0].indexOf('stun') === 0) {
|
if (url_parts[0].indexOf('stun') === 0) {
|
||||||
// Create iceServer with stun url.
|
// Create iceServer with stun url.
|
||||||
iceServer = { 'url': url };
|
iceServer = { 'url': url };
|
||||||
} else if (url_parts[0].indexOf('turn') === 0 &&
|
} else if (url_parts[0].indexOf('turn') === 0) {
|
||||||
(url.indexOf('transport=udp') !== -1 ||
|
if (webrtcDetectedVersion < 27) {
|
||||||
url.indexOf('?transport') === -1)) {
|
// Create iceServer with turn url.
|
||||||
// Create iceServer with turn url.
|
// Ignore the transport parameter from TURN url for FF version <=27.
|
||||||
// Ignore the transport parameter from TURN url.
|
var turn_url_parts = url.split("?");
|
||||||
var turn_url_parts = url.split("?");
|
// Return null for createIceServer if transport=tcp.
|
||||||
iceServer = { 'url': turn_url_parts[0],
|
if (turn_url_parts[1].indexOf('transport=udp') === 0) {
|
||||||
'credential': password,
|
iceServer = { 'url': turn_url_parts[0],
|
||||||
'username': username };
|
'credential': password,
|
||||||
|
'username': username };
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// FF 27 and above supports transport parameters in TURN url,
|
||||||
|
// So passing in the full url to create iceServer.
|
||||||
|
iceServer = { 'url': url,
|
||||||
|
'credential': password,
|
||||||
|
'username': username };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return iceServer;
|
return iceServer;
|
||||||
};
|
};
|
||||||
@ -90,17 +99,10 @@ if (navigator.mozGetUserMedia) {
|
|||||||
// Create iceServer with stun url.
|
// Create iceServer with stun url.
|
||||||
iceServer = { 'url': url };
|
iceServer = { 'url': url };
|
||||||
} else if (url_parts[0].indexOf('turn') === 0) {
|
} else if (url_parts[0].indexOf('turn') === 0) {
|
||||||
if (webrtcDetectedVersion < 28) {
|
// Chrome M28 & above uses below TURN format.
|
||||||
// For pre-M28 chrome versions use old TURN format.
|
iceServer = { 'url': url,
|
||||||
var url_turn_parts = url.split("turn:");
|
'credential': password,
|
||||||
iceServer = { 'url': 'turn:' + username + '@' + url_turn_parts[1],
|
'username': username };
|
||||||
'credential': password };
|
|
||||||
} else {
|
|
||||||
// For Chrome M28 & above use new TURN format.
|
|
||||||
iceServer = { 'url': url,
|
|
||||||
'credential': password,
|
|
||||||
'username': username };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return iceServer;
|
return iceServer;
|
||||||
};
|
};
|
||||||
@ -128,27 +130,6 @@ if (navigator.mozGetUserMedia) {
|
|||||||
reattachMediaStream = function(to, from) {
|
reattachMediaStream = function(to, from) {
|
||||||
to.src = from.src;
|
to.src = from.src;
|
||||||
};
|
};
|
||||||
|
|
||||||
// The representation of tracks in a stream is changed in M26.
|
|
||||||
// Unify them for earlier Chrome versions in the coexisting period.
|
|
||||||
if (!webkitMediaStream.prototype.getVideoTracks) {
|
|
||||||
webkitMediaStream.prototype.getVideoTracks = function() {
|
|
||||||
return this.videoTracks;
|
|
||||||
};
|
|
||||||
webkitMediaStream.prototype.getAudioTracks = function() {
|
|
||||||
return this.audioTracks;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// New syntax of getXXXStreams method in M26.
|
|
||||||
if (!webkitRTCPeerConnection.prototype.getLocalStreams) {
|
|
||||||
webkitRTCPeerConnection.prototype.getLocalStreams = function() {
|
|
||||||
return this.localStreams;
|
|
||||||
};
|
|
||||||
webkitRTCPeerConnection.prototype.getRemoteStreams = function() {
|
|
||||||
return this.remoteStreams;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
console.log("Browser does not appear to be WebRTC-capable");
|
console.log("Browser does not appear to be WebRTC-capable");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user