[mediacapture-screen-share] Missing spec-compliant way to detect shareable surfaces (#309)

eladalon1983 has just created a new issue for https://github.com/w3c/mediacapture-screen-share:

== Missing spec-compliant way to detect shareable surfaces ==
Some Web applications want to display a button that either says "Share a window or screen" or "Share a tab, window or screen" depending on what the browser will offer the user. Currently, applications resort to checking Chrome/Edge vs. Safari/Firefox, but that's not future-proof. (It's not even past-proof, actually, as relatively recent Safari versions only supported "screen".)

```js
const unlocalizedLabel =
    isChromium() ? "Share a window or screen" : "Share a tab, window or screen";
```

It would be good if we add a spec-compliant way for the user agent to report supported surface types before getDisplayMedia() is invoked. (Note that `getCapabilities()` is not useful here - it is exposed on the track itself, which is only obtainable **after** the user clicks the button.)

As a straw-man proposal, how about:
```webidl
dictionary UserAgentCaptureCapabilities {
  sequence<DisplayCaptureSurfaceType> displaySurfaces;
};

partial class MediaDevices {
  UserAgentCaptureCapabilities getCapabilities();
}
```

If fingerprinting is a concern, we could perhaps gate `MediaDevices.getCapabilities()` on mic/camera permissions or something similar.

Please view or discuss this issue at https://github.com/w3c/mediacapture-screen-share/issues/309 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 3 December 2024 10:00:42 UTC