[mediacapture-main] First web compat issue with permissions.query() in per-camera/mic permission models (#927)

jan-ivar has just created a new issue for https://github.com/w3c/mediacapture-main:

== First web compat issue with permissions.query() in per-camera/mic permission models ==
[Permissions integration](https://w3c.github.io/mediacapture-main/#permissions-integration) says: _"If the descriptor does not have a [deviceId](https://w3c.github.io/mediacapture-main/#dom-devicepermissiondescriptor-deviceid), its semantic is that it queries for access to all devices of that class."_ — Since no-one's implemented `deviceId`, this is the norm for sites today:
```js
const perm = await navigator.permissions.query({name: "camera"});
if (perm.state == "prompt") {
  nagTheUserAboutEnablingPermission();
}
```
But this site is trying to ask _"can I call getUserMedia unprompted?"_, not _"do I categorically have access to ALL cameras?"_

Even _after the site has a camera_, Firefox cannot answer yes here, because it grants per-device permissions by default, not to ALL.

It would be more web compatible to say: _"If the descriptor does not have a [deviceId](https://w3c.github.io/mediacapture-main/#dom-devicepermissiondescriptor-deviceid), its semantic is that it queries for access to the default device of that class."_

Sites that truly wish to check the permission state of multiple cameras are able to [do so](https://www.w3.org/TR/permissions/#example-checking-permission-state-of-multiple-cameras).

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


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

Received on Friday, 3 February 2023 15:19:22 UTC