Open yell0wd0g opened 7 years ago
We already have the issue that tracks can have nothing in them periodically in WebRTC. Being consistent with that might be best.
An issue with a promise approach is that what is rendered by the media element may change over time (e.g., it may have no tracks due to a cross-origin resource, but later play a src on the same origin); whereas a promise is a one-off.
Also the application already knows whether or not it uses cross-origin resources, so using a promise goes against principles we have called out before (like no "ended" event on track.stop()).
To understand the full state of the rendered media one has to monitor the tracks of the MediaStream IMHO.
My proposal only includes creation, i.e.: Promise<void> captureStream()
will be resolve
d with a captured MediaStream that from that point onwards behaves normally including adding/removing tracks being signalled via its events.
Spec says [here](https://w3c.github.io/mediacapture-fromelement/#dom-htmlmediaelement-capturestream()):
Which essentially dumps onto the WebApp to monitor the MediaStream to check if and when there is actual content in the
<video>/<audio>
. Instead, I propose changingcaptureStream()
to return aPromise
that gets fulfilled when there is active rendering on the Media Element, and gets rejected e.g. due to cross-origin checks (note that currently such a condition is not flagged in any way except for just having no data in the Tracks, i.e.)