New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 648553 link

Starred by 12 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Cannot use Permissions API to get status of camera

Reported by joe.pal...@iproov.com, Sep 20 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36

Steps to reproduce the problem:
Run the following command in the console:

navigator.permissions.query({name: 'camera'})

What is the expected behavior?
A promise with camera permission status as defined here:

https://w3c.github.io/permissions/#dom-permissionname-camera

What went wrong?
Failed to read the 'query' property from 'Permissions': The provided value 'camera' is not a valid enum value of type PermissionName.

Did this work before? No 

Chrome version: 52.0.2743.116  Channel: n/a
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 23.0 r0
 
Components: -Blink Blink>PermissionsAPI
Cc: raymes@chromium.org

Comment 3 by raymes@chromium.org, Sep 21 2016

Owner: hta@chromium.org
hta: could you help find the right person to add this API? 
Is there anyway I can help get this issue looked at?

Comment 5 by hta@chromium.org, Apr 5 2017

Owner: guidou@chromium.org
Thanks for assigning an owner. Let me know if there is anything I can do to help.
+1.  If I can help then let me know.
I would be great if we can get some progress on this. At the moment, the only way check if we have permission is by turning the camera on and off again which is not a great user experience.

Comment 9 by fi...@appear.in, Jun 27 2017

#8: use navigator.mediaDevices.enumerateDevices and check if the device has a track label. If it has you have permission.
Nice one, thanks for the tip! :)
Note that you can't use that to discern the difference between a dismissal or a denial of the prompt -- the lack of a label will still mean either "prompt" or "denied". Still would be really beneficial to use the much more powerful Permission API for this.
Totally agree, the Permission API would be the best way of doing this. But we should be able to use the presence of label to determine if permission was granted in a previous session without having to request access (and turning on the camera).
Labels: M-61 OS-Linux OS-Windows
Status: Untriaged (was: Unconfirmed)
Able to reproduce this issue on Windows 10, Ubuntu 14.04 and Mac 10.12.5 with chrome Stable #59.0.3071.115, Canary #61.0.3149.0 and also in earlier version #45.0.2454.101, hence marking it as untriaged.

Attaching a screen-cast for reference.
648553.png
204 KB View Download
Cc: guidou@chromium.org
Owner: ----
Status: Available (was: Untriaged)
Owner: dominickn@chromium.org
Status: Started (was: Available)
I have a WIP CL for this now.
Cc: rbyers@chromium.org
+rbyers - I'm not sure if this will require an intent to ship. The intent to ship for the permissions API did not list these permissions (https://groups.google.com/a/chromium.org/forum/#!search/intent$20to$20ship$20permissions$20api/blink-dev/exHjHQzY6m0/tIkqg_W2fjIJ), but we're not really changing the web-exposed surface here. Perhaps a web-facing PSA and mention in the blog post will be sufficient? WDYT?
It is technically a new API (we need to update MDN) but I agree it's trivial.  If you just want to reply to the original intent thread to update it (saying I didn't think a new intent was necessary), that's fine with me.  Just make sure MDN gets updated (yourself and/or by jmedley).
Cc: jmedley@chromium.org
c#17: thanks! I'll reply to the original intent thread to update it when I land the patch.

+jmedley for visibility - when my patch lands, we'll want to update MDN to say that "camera" and "microphone" are available in navigator.permissions.query().
Labels: -M-61
Project Member

Comment 21 by bugdroid1@chromium.org, Nov 16 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/04f4a2b429d099ecfe0fb80de34797b4fd52fddf

commit 04f4a2b429d099ecfe0fb80de34797b4fd52fddf
Author: Dominick Ng <dominickn@chromium.org>
Date: Thu Nov 16 01:26:32 2017

Allow the Permissions API to get the status of the camera and microphone.

This CL adds camera and microphone to the permissions that can be
queried using navigator.permissions.query().

BUG= 648553 

Change-Id: I238ce81401862918c4a01b331142c59756862f5e
Reviewed-on: https://chromium-review.googlesource.com/765619
Reviewed-by: Raymes Khoury <raymes@chromium.org>
Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
Commit-Queue: Dominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516940}
[modify] https://crrev.com/04f4a2b429d099ecfe0fb80de34797b4fd52fddf/third_party/WebKit/LayoutTests/http/tests/permissions/resources/test-query.js
[modify] https://crrev.com/04f4a2b429d099ecfe0fb80de34797b4fd52fddf/third_party/WebKit/Source/modules/permissions/PermissionDescriptor.idl
[modify] https://crrev.com/04f4a2b429d099ecfe0fb80de34797b4fd52fddf/third_party/WebKit/Source/modules/permissions/Permissions.cpp

Status: Fixed (was: Started)
I've now updated the MDN docs (https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query) mentioning Chrome 64 as supporting these. :)

Sign in to add a comment