Reputation: 69
I am using adapter.js in my webrtc 1-1 video call application. It works fine on Google Chrome and both peers see each other's video and can hear audio. However, when I run the same application on FireFox, I get the following error on console which comes from adapter.js.
NS_ERROR_UNEXPECTED
This is the function from adapter.js which gives the above error on return statement:
var RTCPeerConnection = function(pcConfig, pcConstraints) {
// .urls is not supported in FF yet.
maybeFixConfiguration(pcConfig);
return new mozRTCPeerConnection(pcConfig, pcConstraints);
};
This is what is inside pcConfig:
{"iceServers":[{"url":"stun:stun.l.google.com:19302"}]}
This is what is inside pcConstraints:
{"optional":[{"DtlsSrtpKeyAgreement":true},{"RtpDataChannels":true}],"mandatory":{}}
This is how the function maybeFixConfiguration(pcConfig)
looks like:
function maybeFixConfiguration(pcConfig) {
if (pcConfig == null) {
return;
}
for (var i = 0; i < pcConfig.iceServers.length; i++) {
if (pcConfig.iceServers[i].hasOwnProperty('urls')){
pcConfig.iceServers[i]['url'] = pcConfig.iceServers[i]['urls'];
delete pcConfig.iceServers[i]['urls'];
}
}
}
I don't understand what mistake I am doing here. Is something wrong with pcConfig and pcConstraints structure. I am using the latest FireFox I downloaded today.
Upvotes: 3
Views: 1822
Reputation: 76
This may be outdated but it may be of some help.
I had the same NS_ERROR_UNEXPECTED
when creating the new RTCPeerConnection(config)
.
My problem was that my iceServers
array had an invalid urls
part that was giving problems to Firefox, specifically i had
urls: 'turn:someUsername@ipAddress:port'
I found out after some time that someUsername@
was not acceptable to FF although it works on Chrome.
Removing the username@
part of the string fixed the issue for me, hope it helps.
Upvotes: 3
Reputation: 42500
Update your browser. Fully qualified domain names in iceServer URLs have been supported since Firefox 22 (circa March 2013), and adapter.js
does not generally cover browsers that old.
Also, note that createIceServer
is no longer needed - and unavailable - in the latest version of adapter.js. There's still a polyfill in there for some changes in syntax, but it is handled transparently now, without needing to use this special function.
Upvotes: 0
Reputation: 69
I found the mistake, it was in how we specify the iceServers.
Correction is :
{'iceServers': [
createIceServer(isChrome
? 'stun:stun.l.google.com:19302'
: 'stun:23.21.150.121', null, null)
]}
Upvotes: 0