w3c / mediacapture-screen-share

Media Capture Screen Capture specification
https://w3c.github.io/mediacapture-screen-share/
Other
87 stars 28 forks source link

Can I share some Windows? #280

Closed trookie2000 closed 9 months ago

trookie2000 commented 1 year ago

Let's say I have six apps on my desktop and I can choose to share three of them at the same time.

jan-ivar commented 1 year ago

This already seems possible. E.g. this:

button.onclick = async () => await Promise.all([0,1,2].map(async () => {
  videos[i++].srcObject = await navigator.mediaDevices.getDisplayMedia({video: true});
}));

...works in all browsers and should prompt the user 3 times for different apps to share and then share them simultaneously.

Since all three calls to getDisplayMedia are invoked at once (on the same task), any browser vendor interested in experimenting with presenting the user with an optimized picker for this situation should be able to.

jan-ivar commented 1 year ago

This use case is a good example of where the browsers' auto focus behavior is undesirable. Fortunately, the spec has a fix for this, but it's not broadly implemented yet. It'd be something like:

button.onclick = async () => await Promise.all([0,1,2].map(async () => {
  const controller = new CaptureController;
  controller.setFocusBehavior("focus-capturing-application");
  videos[i++].srcObject = await navigator.mediaDevices.getDisplayMedia({video: true, controller});
}));
eladalon1983 commented 1 year ago

I think OP would not appreciate having to remember which 5 windows he had previously chosen to share, when the 6th prompt is put up. That's where w3c/mediacapture-screen-share-extensions#8 would be helpful.

trookie2000 commented 1 year ago

This already seems possible. E.g. this:

button.onclick = async () => await Promise.all([0,1,2].map(async () => {
  videos[i++].srcObject = await navigator.mediaDevices.getDisplayMedia({video: true});
}));

...works in all browsers and should prompt the user 3 times for different apps to share and then share them simultaneously.

Since all three calls to getDisplayMedia are invoked at once (on the same task), any browser vendor interested in experimenting with presenting the user with an optimized picker for this situation should be able to.

s it feasible to write this way now? I can share three applications directly at the same time

eladalon1983 commented 1 year ago

@trookie2000, asking clearer questions will help you get clearer answers.

jan-ivar commented 1 year ago

s it feasible to write this way now? I can share three applications directly at the same time

What do you mean by "at the same time"?

  1. If you mean concurrently capturing 3 applications, then yes this is possible today. Did you try my link?
  2. If you mean multi-select in the UX picker, then no browser implements that.
eladalon1983 commented 1 year ago

If you mean multi-select in the UX picker, then no browser implements that.

No browser implements that today, but I think that we should. https://github.com/w3c/mediacapture-screen-share-extensions/issues/8

jan-ivar commented 1 year ago

I think OP would not appreciate having to remember which 5 windows he had previously chosen to share, when the 6th prompt is put up. That's where https://github.com/w3c/mediacapture-screen-share-extensions/issues/8 would be helpful.

The OP was sharing 3 windows, not 5. With my updated fiddle keeping track of what's been selected is not too bad:

image

It's also trivial to mix tab, window and desktop sharing, something that would be difficult to do from within a browser prompt without introducing a similar level of complexity.

The fiddle can also trivially be extended to allow changing individual choices later, an often desirable feature that is easy to miss if we focus solely on the initial picking problem.

eladalon1983 commented 1 year ago

In my opinion, it is in fact hard. Users are busy people juggling multiple tasks. They shouldn't be expected to give the tedious task of picking N windows the same attention they give an IQ test. We can make it dead simple for them.

But full disclosure - implementing getDisplayMediaSet is not currently on my plan for the next year. Given that even if you do come around to my way of thinking on this, still neither of us would implement it in the near future, perhaps we could let this topic rest until such a time as someone has renewed interest in getDisplayMediaSet. I mention this out of respect for your time. Up to you.

trookie2000 commented 1 year ago

What about capturing three applications simultaneously in a virtual desktop environment? Specifically, I don't want the application to appear three video tags to capture the shared application in turn (in fact, the user doesn't know how many to share, it could be three, or five, so should we write five video tag?)

I think it works pretty well#204,But I don't know how difficult it is to achieve. 1695187506797

jan-ivar commented 1 year ago

@trookie2000 sorry I'm not exactly sure what you're asking, but here's an updated fiddle that only creates video elements as needed, for as many captures as you want (but still prompts for each one in current browsers).

In today's browsers this should keep asking the user to pick a window until the user hits "Not Now" when they've added as many as they want.

Or so I thought. Turns out they don't bail out, and allows the app to prompt spam instead. I've filed bug 1854259 on this in Firefox. Feel free to open bugs on other browsers.

trookie2000 commented 1 year ago

My idea is to allow users to select one or more Windows in a screen sharing session and overlay them on a background picture of their choice. This is very useful for Google meetings or zoom meetings, where, instead of sharing their entire screen (privacy) or having to choose a window (lack of flexibility), people can share several Windows at once and add/remove them at any time.

trookie2000 commented 1 year ago

Something like this 1695276609842 That is, multiple Windows selected by the user can also be shared into an interface, and the shared picture is displayed according to the thin line.

Another idea is to share a window (such as a folder), so that the window generated by the button in the window can also be shared,Something like that.The latter two Windows were clicked under the first window and should also be displayed for sharing

https://github.com/w3c/mediacapture-screen-share/assets/109945614/6a19ff4f-1913-4d90-9593-301d58fd481e

bradisbell commented 1 year ago

@trookie2000 You can do what you are asking for today. The only problems are from a UX perspective, where browsers will show multiple "I'm-capturing-stuff" bars at the top of the window, and that the user has to go through the flow to select a window each time... there isn't an option to Ctrl+Click or something like that to add more.

trookie2000 commented 10 months ago

To achieve this, provide the user with a media selector with checkbox-like functionality,maybe the user can choose any N tabs, any N windows, or any N monitors, but not a combination of K tabs and N-K screens.How do I write the code to implement this functionality image

aboba commented 9 months ago

Duplicate of w3c/mediacapture-screen-share-extensions#8