Переглянути джерело

Merge pull request #454 from ilya-konanykhin/fix/453_deprecated_onaddstream

#453 Change deprecated onaddstream to ontrack
Jairooo 6 роки тому
батько
коміт
5fb03eb052
1 змінених файлів з 2 додано та 7 видалено
  1. 2 7
      lib/negotiator.js

+ 2 - 7
lib/negotiator.js

@@ -186,15 +186,10 @@ Negotiator._setupListeners = function(connection, pc, pc_id) {
 
   // MEDIACONNECTION.
   util.log("Listening for remote stream");
-  pc.onaddstream = function(evt) {
+  pc.ontrack = function(evt) {
     util.log("Received remote stream");
-    var stream = evt.stream;
+    var stream = evt.streams[0];
     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);
     }