W3C home > Mailing lists > Public > public-webrtc@w3.org > August 2018

[webrtc-pc] pc.getSenders() and getReceivers() include stopped ones.

From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
Date: Wed, 29 Aug 2018 12:49:15 +0000
To: public-webrtc@w3.org
Message-ID: <issues.opened-355144595-1535546953-sysbot+gh@w3.org>
jan-ivar has just created a new issue for https://github.com/w3c/webrtc-pc:

== pc.getSenders() and getReceivers() include stopped ones. ==
Here's how I'd play pc tracks without any associated streams:
```js
video.srcObject = new MediaStream(pc.getTransceivers()
                                  .filter(tc => !tc.stopped)
                                  .map(tc => tc.receiver.track));
```
The problem is, [EXAMPLE 11](http://w3c.github.io/webrtc-pc/#peer-to-peer-example-with-media-before-signaling) uses:
```js
remoteView.srcObject = new MediaStream(pc.getReceivers().map(r => r.track));
```

Unfortunately, the latter and shorter incantation might include stopped receivers I'm not expecting.

Worse, `pc.getReceivers()` offers no easy way to tell whether my receivers are stopped or not. 

Maybe it should only return non-stopped receivers?

Same question for `pc.getSenders()`.

It turns out *HTMLVideoElement* conveniently ignores ended tracks, so the above still works. But this just seems to bury the surprise even further, and I could see people tripping over this in other situations.

Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1975 using your GitHub account
Received on Wednesday, 29 August 2018 12:49:16 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:18:43 UTC