瀏覽代碼

Fixes #246, but we should figure out why addStream is happening.

Michelle Bu 10 年之前
父節點
當前提交
63c1e3539c
共有 3 個文件被更改,包括 18 次插入2 次删除
  1. 9 1
      dist/peer.js
  2. 0 0
      dist/peer.min.js
  3. 9 1
      lib/negotiator.js

+ 9 - 1
dist/peer.js

@@ -574,7 +574,15 @@ Negotiator._setupListeners = function(connection, pc, pc_id) {
   pc.onaddstream = function(evt) {
     util.log('Received remote stream');
     var stream = evt.stream;
-    provider.getConnection(peerId, connectionId).addStream(stream);
+    var connection = provider.getConnection(peerId, connectionId);
+    // 10/10/2014: looks like in Chrome 38, onaddstream is triggered after
+    // setting the remote description. Our connection object in these cases
+    // is actually a DATA connection, so addStream fails.
+    // TODO: This is hopefully just a temporary fix. We should try to
+    // understand why this is happening.
+    if (connection.type === 'media') {
+      connection.addStream(stream);
+    }
   };
 }
 

文件差異過大導致無法顯示
+ 0 - 0
dist/peer.min.js


+ 9 - 1
lib/negotiator.js

@@ -187,7 +187,15 @@ Negotiator._setupListeners = function(connection, pc, pc_id) {
   pc.onaddstream = function(evt) {
     util.log('Received remote stream');
     var stream = evt.stream;
-    provider.getConnection(peerId, connectionId).addStream(stream);
+    var connection = provider.getConnection(peerId, connectionId);
+    // 10/10/2014: looks like in Chrome 38, onaddstream is triggered after
+    // setting the remote description. Our connection object in these cases
+    // is actually a DATA connection, so addStream fails.
+    // TODO: This is hopefully just a temporary fix. We should try to
+    // understand why this is happening.
+    if (connection.type === 'media') {
+      connection.addStream(stream);
+    }
   };
 }
 

部分文件因文件數量過多而無法顯示