Skip to content

Commit

Permalink
Change deprecated onaddstream to ontrack
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-konanykhin committed Oct 1, 2018
1 parent 3dbc8a1 commit 9b1f661
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/negotiator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 9b1f661

Please sign in to comment.