Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.sendCaptureAction() seems misplaced on the track #65

Open
jan-ivar opened this issue May 16, 2022 · 3 comments
Open

.sendCaptureAction() seems misplaced on the track #65

jan-ivar opened this issue May 16, 2022 · 3 comments

Comments

@jan-ivar
Copy link
Member

track.sendCaptureAction, the API to send supported actions to the captured page seems misplaced on the MediaStreamTrack. The reasons are:

  1. MediaStreamTrack is a clonable & constrainable media consumption abstraction. One source → many consumers. Whereas methods like track.cropTo are per-clone, sendCaptureAction would affect ALL clones, a leaky abstraction. The progression of the capture is not a property of a single video track.
  2. Would both the video and audio track have this method? Why (not)? It's confusing.

We’ve stepped out of media consumption to remote control.

A higher level object seems needed, one that isn't clonable or necessarily shared with every media consumer. Likewise, w3c/mediacapture-screen-share#190 seems to similarly need this higher level object.

See #12 (comment) for ideas on such a higher level object, which I'm scheduled to present tomorrow.

@eladalon1983
Copy link
Member

eladalon1983 commented May 16, 2022

sendCaptureAction would affect ALL clones, a leaky abstraction.

It does not affect all clones, or any of the clones. The tracks themselves are not affected by sendCaptureAction. The tracks are merely conduits. All roads lead to Rome - the single captured tab, and its single registered event handler.

Would both the video and audio track have this method?

The same reasoning (all roads lead to Rome) convinces me that it would be fine to expose on both audio and video.

@youennf
Copy link

youennf commented May 16, 2022

My general mental model is that a method that only impacts the track should go to the track.
A method that impacts the source (so all tracks) is better to keep outside of tracks.

Having a single place for actions is a good simplification and will make things simpler.
Having the ability to transfer a track but keep control of the capture/action manager adds flexibility to web applications, without making them any less powerful.

It also seems like it will be a simpler and less error prone programmatic model for web developers.
It might also be easier to implement for UA, past the boiler plate to add the probably new interface required by such a container.

Overall adding this separate container looks like a nice addition, so it seems good to have a try.
We should probably dive into the details to fully validate this.
For instance, making it Transferable like MediaStreamTrack might be a good idea as some applications might want to delegate both track and action handling to a separate context (say a worker). But this might have impact on the corresponding API the capturer might support.

@alvestrand
Copy link

If we want to think about exposing the source as an object, we'd better think about exposing the source as an object.

Some sources (VTG, capture-from-element) are objects already, but there's no generic source object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants