W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > July 2017

Re: [webrtc-pc] Add legacy note about addStream.

From: Taylor Brandstetter via GitHub <sysbot+gh@w3.org>
Date: Wed, 12 Jul 2017 21:40:28 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issue_comment.created-314905304-1499895626-sysbot+gh@w3.org>
Looks good, but should we also acknowledge the behavior described [here](https://bugs.chromium.org/p/webrtc/issues/detail?id=7815)? This makes the polyfill slightly more complicated:

```
RTCPeerConnection.prototype.addStream = function(stream) {
  var pc = this;
  stream.getTracks().forEach(function(track) {
    pc.addTrack(track, stream);
  });
  // Listen to future changes to the stream, and add/remove tracks automatically.
  oldAddTrack = stream.addTrack;
  oldRemoveTrack = stream.removeTrack;
  stream.addTrack = function(track) {
    pc.addTrack(track, stream);
    oldAddTrack.call(stream, track);
  }
  stream.removeTrack = function(track) {
    pc.removeTrack(track, stream);
    oldRemoveTrack.call(stream, track);
  }
};
```

-- 
GitHub Notification of comment by taylor-b
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/pull/1451#issuecomment-314905304 using your GitHub account
Received on Wednesday, 12 July 2017 21:40:34 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:21:40 UTC