|
@@ -54,16 +54,33 @@ ConnectionManager.prototype.initialize = function(id, socket) {
|
|
// Listen for ICE candidates.
|
|
// Listen for ICE candidates.
|
|
this._setupIce();
|
|
this._setupIce();
|
|
|
|
|
|
- // Listen for negotiation needed.
|
|
|
|
- // Chrome only **
|
|
|
|
- this._setupNegotiationHandler();
|
|
|
|
-
|
|
|
|
// Listen for data channel.
|
|
// Listen for data channel.
|
|
this._setupDataChannel();
|
|
this._setupDataChannel();
|
|
|
|
|
|
|
|
+ // Listen for negotiation needed.
|
|
|
|
+ // Chrome only--Firefox instead has to manually makeOffer.
|
|
|
|
+ if (util.browserisms !== 'Firefox') {
|
|
|
|
+ this._setupNegotiationHandler();
|
|
|
|
+ } else if (this._options.originator) {
|
|
|
|
+ this._firefoxAdditional()
|
|
|
|
+ }
|
|
|
|
+
|
|
this.initialize = function() { };
|
|
this.initialize = function() { };
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+/** Firefoxism that requires a fake media stream. */
|
|
|
|
+ConnectionManager.prototype._firefoxAdditional = function() {
|
|
|
|
+ var self = this;
|
|
|
|
+ getUserMedia({ audio: true, fake: true }, function(s) {
|
|
|
|
+ self.pc.addStream(s);
|
|
|
|
+ if (self._options.originator) {
|
|
|
|
+ self._makeOffer();
|
|
|
|
+ } else {
|
|
|
|
+ self._makeAnswer();
|
|
|
|
+ }
|
|
|
|
+ }, function(err) { util.log('Could not getUserMedia'); });
|
|
|
|
+};
|
|
|
|
+
|
|
/** Start a PC. */
|
|
/** Start a PC. */
|
|
ConnectionManager.prototype._startPeerConnection = function() {
|
|
ConnectionManager.prototype._startPeerConnection = function() {
|
|
util.log('Creating RTCPeerConnection');
|
|
util.log('Creating RTCPeerConnection');
|
|
@@ -210,13 +227,30 @@ ConnectionManager.prototype._attachConnectionListeners = function(connection) {
|
|
|
|
|
|
/** Handle an SDP. */
|
|
/** Handle an SDP. */
|
|
ConnectionManager.prototype.handleSDP = function(sdp, type) {
|
|
ConnectionManager.prototype.handleSDP = function(sdp, type) {
|
|
- sdp = new RTCSessionDescription(sdp);
|
|
|
|
|
|
+ if (util.browserisms !== 'Firefox') {
|
|
|
|
+ // Doesn't need to happen for FF.
|
|
|
|
+ sdp = new RTCSessionDescription(sdp);
|
|
|
|
+ }
|
|
|
|
|
|
var self = this;
|
|
var self = this;
|
|
this.pc.setRemoteDescription(sdp, function() {
|
|
this.pc.setRemoteDescription(sdp, function() {
|
|
util.log('Set remoteDescription: ' + type);
|
|
util.log('Set remoteDescription: ' + type);
|
|
if (type === 'OFFER') {
|
|
if (type === 'OFFER') {
|
|
- self._makeAnswer();
|
|
|
|
|
|
+ if (util.browserisms === 'Firefox') {
|
|
|
|
+ self._firefoxAdditional();
|
|
|
|
+ } else {
|
|
|
|
+ self._makeAnswer();
|
|
|
|
+ }
|
|
|
|
+ } else if (util.browserisms === 'Firefox') {
|
|
|
|
+ // Firefoxism.
|
|
|
|
+ self.pc.connectDataConnection(self.localPort, self.remotePort);
|
|
|
|
+ self._socket.send({
|
|
|
|
+ type: 'PORT',
|
|
|
|
+ payload: {
|
|
|
|
+ remote: self._localPort,
|
|
|
|
+ local: self._remotePort
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}, function(err) {
|
|
}, function(err) {
|
|
self.emit('error', err);
|
|
self.emit('error', err);
|