diff --git a/static/js/mediastream/peerconnection.js b/static/js/mediastream/peerconnection.js index 1db75f2f..f91d2b57 100644 --- a/static/js/mediastream/peerconnection.js +++ b/static/js/mediastream/peerconnection.js @@ -70,7 +70,16 @@ define(['jquery', 'underscore', 'webrtc.adapter'], function($, _) { // for example https://bugzilla.mozilla.org/show_bug.cgi?id=998546. pc.onaddstream = _.bind(this.onRemoteStreamAdded, this); pc.onremovestream = _.bind(this.onRemoteStreamRemoved, this); - pc.onnegotiationneeded = _.bind(this.onNegotiationNeeded, this); + // NOTE(longsleep): onnegotiationneeded is not supported by Firefox + // https://bugzilla.mozilla.org/show_bug.cgi?id=840728 + if (webrtcDetectedBrowser === "firefox") { + window.setTimeout(_.bind(function() { + // Trigger onNegotiationNeeded once for Firefox. + this.onNegotiationNeeded({target: pc}); + }, this), 0); + } else { + pc.onnegotiationneeded = _.bind(this.onNegotiationNeeded, this); + } pc.ondatachannel = _.bind(this.onDatachannel, this); pc.onsignalingstatechange = function(event) { // XXX(longsleep): Remove this or handle it in a real function. diff --git a/static/js/mediastream/webrtc.js b/static/js/mediastream/webrtc.js index 353e08e0..6a3a2366 100644 --- a/static/js/mediastream/webrtc.js +++ b/static/js/mediastream/webrtc.js @@ -682,6 +682,7 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u WebRTC.prototype.sendOfferWhenNegotiationNeeded = function(currentcall, to) { + // TODO(longsleep): Check if the check for stable is really required. if (currentcall.peerconnection.pc.signalingState === "stable") { if (!to) { to = currentcall.id;