Face-api.js: How to access client's webcam

Created on 6 Aug 2019  路  7Comments  路  Source: justadudewhohacks/face-api.js

When i locally host this code, it works fine with the localhost:3000 address. But when I try to use the URL from a different machine, the webcam access prompt is not there. So, what needs to be done to solve this problem???

Thanks in advance.

question

Most helpful comment

Are you accessing through http or https to the url? Chrome (but I think the rest of browsers too) do not allow access to camera under http, only through https. (something I remember, not sure at 100%)

Thats why when you access through localhost it works but not for the rest of the devices.

All 7 comments

i think you need use server connect camera ip then tranfer data to client,
you see https://github.com/linhbkhn95/Steaming-IP-Camera-Nodejs

I am not using this code for streaming. I just want that anyone who opens the link can test the age and gender model using their own webcam. No need to stream or transfer images back to server. I hope I am clear on this.

without transfer image back to server,we can't calculate anything

to my knowledge it not possible

The issue could have multiple causes, do you receive any error? I also want to point out that this is a general javascript question and not related to face-api.js.

Are you accessing through http or https to the url? Chrome (but I think the rest of browsers too) do not allow access to camera under http, only through https. (something I remember, not sure at 100%)

Thats why when you access through localhost it works but not for the rest of the devices.

Closing because of inactivity, if this is still an issue, feel free to reopen and provide the requested information.

Was this page helpful?
0 / 5 - 0 ratings