Re: [mediacapture-fromelement] Should tracks captured from a media element fire "ended" when ending? (#77)

> @Pehrsons The `ended` event should be dispatched when `stop()` is called on a `MediaStreamTrack`, meaning Chromium implementation is not specification compliant (#78; [#78 (comment)](https://github.com/w3c/mediacapture-fromelement/issues/78#issuecomment-492297460); https://bugs.chromium.org/p/chromium/issues/detail?id=963018), correct?

Not correct per the latest draft: https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-stop

It used to be however, but it was removed, motivated with "the application already knows since it called stop()" or an argument like that. You can probably blame your way to it if you have some spare time on your hands.

> https://www.w3.org/TR/mediacapture-streams/

Yeah, that's a version from Oct 3, 2017.


> > A MediaStreamTrack object is said to end when the source of the track is disconnected or exhausted.
> > When a MediaStreamTrack track ends for any reason other than the stop() method being invoked, the User Agent MUST queue a task that runs the following steps:
> > 
> > 1. If the track's readyState attribute has the value ended already, then abort these steps.
> > 2. Set track's readyState attribute to ended.
> > 3. Notify track's source that track is ended so that the source may be stopped, unless other MediaStreamTrack objects depend on it.
> > 4. Fire a simple event named ended at the object.
> 
> From this perspective (front-end) if `ended` is not dispatched when `stop()` is called and `muted` is not dispatched when `enabled` set to `false` they are unreliable and essentially useless.

They are certainly not useless. "ended" is dispatched for all reasons of ending the track other than `stop()`. Such reasons could be:
- a captured media element's track ended
- the user revoked gUM permissions
- a peer connection was renegotiated and a received track is no longer transmitted

Similarly, "muted" is dispatched when the UA wants to signal that the source of the track is not producing any data. The most prominent use of this that I know is in peer connections, where a track is muted after it has been signaled but before its connection is up (and producing data).


For the rest of your comment I didn't see a question.



-- 
GitHub Notification of comment by Pehrsons
Please view or discuss this issue at https://github.com/w3c/mediacapture-fromelement/issues/77#issuecomment-496588975 using your GitHub account

Received on Tuesday, 28 May 2019 16:24:25 UTC