webcam "You have denied camera access" Chrome + php

Asked

Viewed 565 times

1

I’m having trouble accessing a webcam on the site using php where I have the message "You have denied camera access", the same script on the site php works well, I have no problem. The hosting I am using is from HOSTINGER, and the browser is the latest version Chrome. I’ve been researching something and for example the plugin https://www.xarg.org/project/jquery-webcam-plugin/ is searching a little more see that has to have ssl because Chrome browser asks for this security someone has had this problem?

1 answer

2


The message in particular:

You have denied camera access

Indicates that you previously denied camera access to previously for the specific domain, it is not necessarily connected to HTTPS, to confirm if your site is blocked in your browser access the address in Chrome:

  • chrome://settings/content/camera

And then see if he’s on the blocked list:

chrome camera

If you are click on the recycle bin design to remove, then the next time you try to use the camera on your site will probably appear the request.


About the HTTPS

As far as I know it is impossible to use camera without HTTPS in Chrome, so for example, the function MediaDevices.getUserMedia() will not work, they did this to prevent unencrypted connections could be intercepted or "attacked" as in Wi-Fi networks for example.

As the warning in https://developers.google.com/web/fundamentals/media/capturing-images/? hl=en#acesse_a_camera_de_forma_interativa

Warning: Direct camera access is a powerful feature and therefore requires user authorization and your site needs to be in a secure source (HTTPS).

If you try this warning will appear on the console:

[Deprecation] getUserMedia() no longer Works on insecure Origins. To use this Feature, you should consider switching your application to a Secure origin, such as HTTPS.

For details of Apis that require HTTPS access:

However in your browser, and only in your own, for testing you can add an allowed domain without HTTPS, just in the Chrome shortcut icon add this

--unsafely-treat-insecure-origin-as-secure="meu-site.com.br"

However as you said it is only in your browser, it will not work for other users/computers, unless the person does it manually, the only solution is to use HTTPS or a third party service to work with videos and webcam.

  • i’m not getting to understand how to use -unsafely-Treat-insecure-origin-as-Secure="my-site.com.br"

  • 1

    @edsonferrari as I said this is not solution, will not make the camera work for other computers, this flag has to be added in the Chrome shortcut, if windows right click on the shortcut selects property, then in "Target" should add something like "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --unsafely-treat-insecure-origin-as-secure="meu-site.com.br""

  • Yes friend, I understand what you taught, but just so I can test, what I told you is happening at the Stinger. Today I ended up buying their ssl, paid as billet, but only on Monday probably they will release, so I wanted to see this interim solution, only this, to have emergency solution.

  • 1

    @edsonferrari quiet, so you managed to change the icon of the shortcut? After changing you need to close the whole browser and go to the icon and open Chrome from it. Good luck.

  • Yes I did, but it didn’t work out very well no, I did exactly what you went through last time, but still the camera is denied access, but still I am more relieved knowing that ssl can solve my problem, is that I did something wrong anyway, not to work this "shortcut"

  • @edsonferrari I explained at the beginning of the reply, access denied is an error, ssl is something else. you checked the explanation of access chrome://settings/content/camera?

  • Yes, and is not in the blocked item on the site, does not block this any site just keeps appearing the message that said above: You have denied camera access.

  • @edsonferrari can send the link from your site?

  • yes, take it there, and http://www.residencialterraverde.com.br/movi_pessoas.php?id=71&token=f6266a8735b9b0fddfae7630431bba04 can search around if you need I can send you the files I’m using on the web cam. This also here appearing a link to move to chat, would be better?

  • 1

    Friend, as I told you, I bought the ssl from Hostinger, I thought they were only going to release on Monday, already released and really was what was missing, this appearing the image of the camera, but I still have some other problems, but it must be of connection and something else that apparently but easy to solve. The information you passed is VALUABLE, it has to be HTTPS, that I learned here. TKS

Show 5 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.