consent-required

camera

The camera policy controls access to video input devices requested through the NavigatorUserMedia interface.

If disabled in a document, then calls to getUserMedia() MUST NOT grant access to video input devices in that document.

How to apply this policy

Send the following HTTP header to control the camera policy, and disallow it on all origins:

Feature-Policy: camera 'none'

Affected use case example

HTML

<video autoplay width="100%"></video>

JavaScript

const video = document.querySelector('video');
if (!('mediaDevices' in navigator)) {
  throw new Error('Device does not have a media capture interface');
}
navigator.mediaDevices.getUserMedia({video: true})
  .then(stream => {
    video.srcObject = stream
    DemoUtils.reportDemoResult(true);
  })
  .catch(err => DemoUtils.reportDemoResult(false, {resultDetail: err.toString()}))
;

Output

Loading...

Waiting for the demo to report a result...

Does it work?

Currently Firefox, and Chromium based browsers, such as Google Chrome, Samsung Internet, and Opera, are the only user-agents to support Feature Policy. The minimum version that correctly recognises the camera policy is:

Mozilla Firefox

65+

Google Chrome

60+

Microsoft Edge

Not supported

Apple Safari

Not supported

Discussion

Disqus seems to be taking longer than usual. Reload?