Skip to content
This repository has been archived by the owner on Dec 4, 2017. It is now read-only.

Commit

Permalink
Skip the default STUN server if the network isn't connected to the In…
Browse files Browse the repository at this point in the history
…ternet (ie Persona can't be loaded).
  • Loading branch information
fqueze committed Feb 4, 2013
1 parent 8c1da14 commit 62f554e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions static/checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var webrtcChecks = {
if (!navigator.mozGetUserMedia)
return false;
try {
var dummy = new window.mozRTCPeerConnection()
var dummy = new window.mozRTCPeerConnection({iceServers: []});
} catch (x) {
return false;
}
Expand All @@ -24,8 +24,14 @@ var webrtcChecks = {
},

checkSidebarSupport: function webrtc_checkSidebarSupport() {
if (!this.hasWebRTC() || !this.hasBrowserId())
if (!this.hasWebRTC())
this.displaySidebarWarning();

if (!this.hasBrowserId()) {
gHasInternetAccess = false;
$("#guest").show();
startGuest();
}
},

displayWarning: function webrtc_displayWarning() {
Expand Down
7 changes: 6 additions & 1 deletion static/media.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var gHasInternetAccess = true;

// This object currently assumes the following elements are defined in the web page for calls:
// remoteVideo, remoteAudio, localVideo, localAudio
var webrtcMedia = {
Expand Down Expand Up @@ -101,7 +103,10 @@ var webrtcMedia = {
_createBasicPc: function webrtcMedia_createBasicPc(aWin, aPerson, aOriginator, aAudioOnly,
aConnectionCallback,
aDataConnectionCallback) {
var pc = new aWin.mozRTCPeerConnection();
var params;
if (!gHasInternetAccess)
params = {iceServers: []};
var pc = new aWin.mozRTCPeerConnection(params);
pc.onaddstream = function(obj) {
var type = obj.type;
if (type == "video") {
Expand Down

0 comments on commit 62f554e

Please sign in to comment.