|
@@ -969,21 +969,26 @@ function DataConnection(id, peer, socket, cb, options) {
|
|
|
this._setupIce();
|
|
|
|
|
|
// Listen for negotiation needed
|
|
|
- this._setupOffer();
|
|
|
+ // ** Chrome only.
|
|
|
+ if (browserisms === 'Webkit') {
|
|
|
+ this._setupOffer();
|
|
|
+ }
|
|
|
|
|
|
// Listen or create a data channel
|
|
|
this._setupDataChannel();
|
|
|
|
|
|
var self = this;
|
|
|
-
|
|
|
+ util.log(0)
|
|
|
if (options.sdp) {
|
|
|
this.handleSDP({type: 'OFFER', sdp: options.sdp});
|
|
|
if (browserisms !== 'Firefox') {
|
|
|
this._makeAnswer();
|
|
|
}
|
|
|
}
|
|
|
+ util.log(1)
|
|
|
|
|
|
- if (browserisms == 'Firefox') {
|
|
|
+ if (browserisms === 'Firefox') {
|
|
|
+ util.log('pop');
|
|
|
this._firefoxAdditional();
|
|
|
}
|
|
|
};
|
|
@@ -1004,7 +1009,9 @@ DataConnection.prototype._setupDataChannel = function() {
|
|
|
if (this._originator) {
|
|
|
util.log('Creating data channel');
|
|
|
this._dc = this._pc.createDataChannel(this._peer, { reliable: false });
|
|
|
+ console.log('cdc');
|
|
|
this._configureDataChannel();
|
|
|
+ console.log('cdc3');
|
|
|
} else {
|
|
|
util.log('Listening for data channel');
|
|
|
this._pc.ondatachannel = function(evt) {
|
|
@@ -1149,13 +1156,15 @@ DataConnection.prototype._firefoxPortSetup = function() {
|
|
|
DataConnection.prototype._configureDataChannel = function() {
|
|
|
var self = this;
|
|
|
|
|
|
- if (browserisms == 'Firefox') {
|
|
|
+ if (browserisms === 'Firefox') {
|
|
|
this._dc.binaryType = 'blob';
|
|
|
}
|
|
|
+ console.log(3)
|
|
|
this._dc.onopen = function() {
|
|
|
util.log('Data channel connection success');
|
|
|
self._cb(null, self);
|
|
|
};
|
|
|
+ console.log(4)
|
|
|
this._dc.onmessage = function(e) {
|
|
|
self._handleDataMessage(e);
|
|
|
};
|