Skip to content

Commit

Permalink
waiting on firefox convergence on createDataChannel location
Browse files Browse the repository at this point in the history
  • Loading branch information
michelle committed Jan 26, 2013
1 parent 91b5734 commit 57f8d41
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 13 deletions.
17 changes: 13 additions & 4 deletions demo/static/peer.js
Expand Up @@ -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();
}
};
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
};
Expand Down
17 changes: 13 additions & 4 deletions dist/peer.js
Expand Up @@ -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();
}
};
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
};
Expand Down

0 comments on commit 57f8d41

Please sign in to comment.