How to allow Chrome to access my camera on localhost?
Are you accessing the webpage that is served over HTTP, on localhost? If you are accessing it from http://localhost/...
, Chrome will ask for your permission to use the camera.
If you are opening the web page directly, i.e. /Users/Methuz/Documents/index.html then it will not work, even if you explicitly allows it permission
In this case, the workaround I use is to host the HTML file on a webserver. A quick hack is to use python, in the folder where the HTML page is lcoated: python -m SimpleHTTPServer
Camera access works on localhost but fails on chrome on server with https
After some research, we were able to find that the reason the camera was being blocked on the testing environment was due to the feature policy header. In our application, it's added via asp.net web.config, since we don't have this on localhost it would work normally.
This will completely block access to camera:
<add name="Feature-Policy" value="camera 'none'" />
In order to enable and allow the browser to request permission, we need to have it as:
<add name="Feature-Policy" value="camera 'self'" />
Browser says "Camera Blocked to protect your privacy"
- type url chrome://flags/#unsafely-treat-insecure-origin-as-secure
- Enter url in the textarea
- Choose Enabled in the select option
Click image link bellow to see detail
example
JavaScript GetUserMedia using Chrome with localhost without HTTPS
You can use a service like https://ngrok.com/ to map a public DNS address with SSL certificate to a port on your local machine.
Related Topics
Jquery Remove Special Characters from String and More
React-Select:Get Default Value in React-Select
Passing Multiple Parameters to Function Using Onclick
Regular Expression Which Matches a Pattern, or Is an Empty String
How to Get the Latest and Oldest Record in Mongoose.Js (Or Just the Timespan Between Them)
Call Method That Inside Another Component - React Js
Image Upload With Preview and Delete Option - Javascript/Jquery
How to Count Duplicate Value in an Array in JavaScript
Javascript Onclick Increment Number
How to Convert Date Format from Dd.Mm.Yyyy to Dd/Mm/Yyyy in JavaScript
How to Set an Iframe Src Attribute from a Variable in Angularjs
Angular 4 Submit Form by Pressing Enter With Login Button
Javascript Index of for Multiple Values
Basic Open Source JavaScript Image Editor
Disabling a Button Within a Stateless Component - React