瀏覽代碼

waiting on firefox convergence on createDataChannel location

Michelle Bu 12 年之前
父節點
當前提交
57f8d41b28
共有 4 個文件被更改,包括 39 次插入12 次删除
  1. 13 4
      demo/static/peer.js
  2. 13 4
      dist/peer.js
  3. 0 0
      dist/peer.min.js
  4. 13 4
      lib/connection.js

+ 13 - 4
demo/static/peer.js

@@ -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);
   };

+ 13 - 4
dist/peer.js

@@ -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);
   };

File diff suppressed because it is too large
+ 0 - 0
dist/peer.min.js


+ 13 - 4
lib/connection.js

@@ -33,21 +33,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();
   }
 };
@@ -68,7 +73,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) {
@@ -213,13 +220,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);
   };

Some files were not shown because too many files changed in this diff