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

Can I share some Windows? #280

Closed
trookie2000 opened this issue Sep 9, 2023 · 16 comments
Closed

Can I share some Windows? #280

trookie2000 opened this issue Sep 9, 2023 · 16 comments

Comments

@trookie2000
Copy link

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
Copy link
Member

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
Copy link
Member

jan-ivar commented Sep 13, 2023

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});
}));

@jan-ivar jan-ivar transferred this issue from w3c/webrtc-pc Sep 13, 2023
@eladalon1983
Copy link
Member

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
Copy link
Author

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
Copy link
Member

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

@jan-ivar
Copy link
Member

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
Copy link
Member

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. w3c/mediacapture-screen-share-extensions#8

@jan-ivar
Copy link
Member

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.

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

@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
Copy link
Author

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
Copy link
Author

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

20230921_142111.mp4

@bradisbell
Copy link

@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
Copy link
Author

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 aboba added duplicate and removed question labels Jan 23, 2024
@aboba
Copy link
Contributor

aboba commented Jan 23, 2024

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

@aboba aboba closed this as completed Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants