Browse Source

Implement workaround for FF not supporting onnegotiationneeded.

pull/112/head
Simon Eisenmann 11 years ago
parent
commit
30888a5ce8
  1. 11
      static/js/mediastream/peerconnection.js
  2. 1
      static/js/mediastream/webrtc.js

11
static/js/mediastream/peerconnection.js

@ -70,7 +70,16 @@ define(['jquery', 'underscore', 'webrtc.adapter'], function($, _) { @@ -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.

1
static/js/mediastream/webrtc.js

@ -682,6 +682,7 @@ function($, _, PeerCall, PeerConference, PeerXfer, PeerScreenshare, UserMedia, u @@ -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;

Loading…
Cancel
Save