WebDevSimplified / Face-Detection-JavaScript

1k stars 1.39k forks source link

camera is not showing in browser #39

Open PratyushKes opened 4 years ago

PratyushKes commented 4 years ago

HI there, my chrome is unable to show the camera, i mean my camera is not opening on chrome.

vinamramunot-tech commented 4 years ago

are you using "localhost" or "127.0.0.1" or "0.0.0.0"? try one of those. Also check https flag at "chrome://flags" and enable that to check if it works

Ikigainuxxxx commented 3 years ago

are you using "localhost" or "127.0.0.1" or "0.0.0.0"? try one of those. Also check https flag at "chrome://flags" and enable that to check if it works

what should i enable?

vinamramunot-tech commented 3 years ago

@Ikigainuxxxx https://community.spiceworks.com/how_to/154601-chrome-allow-localhost-site-even-without-https-certificate

Dushyantsingh-ds commented 3 years ago

This didn't work!

vinamramunot-tech commented 3 years ago

@Dushyantsingh-ds can you share an image and the output of the server when you try to run it? I want to see the output on terminal or the console in dev tools.

vinamramunot-tech commented 3 years ago

@WebDevSimplified you can close this issue

AlexDinger commented 3 years ago

@vinamramunot-tech I am having this issue as well and I have no errors whatsoever but the camera just wont show up

vinamramunot-tech commented 3 years ago

@AlexDinger are you running this on http or https?

one alternative is to enable chrome flags:

  1. go to chrome and in the url bar type "chrome://flags"
  2. enable this flag Screen Shot 2021-04-03 at 11 35 30 PM
  3. run your website as "localhost:". you can have the port number as anything you want, an example is localhost:5050
vinamramunot-tech commented 3 years ago

@AlexDinger Also check if any other application is using the camera. Are you running the code on mac/linux or windows?

mister-bee commented 3 years ago

The actual green camera light goes on, but no image appears on the screen, just a white background. At this url: http://127.0.0.1:5500/face-detection/index.html And this warning in the console:

Screen Shot 2021-04-26 at 8 07 49 AM
vinamramunot-tech commented 3 years ago

@mister-bee try "http://localhost:5500/face-detection/index.html" and enable the flag I have talked about in the previous comment.

abdelmark commented 2 years ago

function startVideo() { navigator.mediaDevices.getUserMedia({ video: {} }).then(stream => { const video = document.getElementById('video') video.srcObject = stream video.paly() }) .catch( err => { console.log('Failed to get local stream' ,err); }) }

use this startVideo function instead.