Warm tip: This article is reproduced from serverfault.com, please click

Accessing a user's webcam in Heroku

发布于 2020-12-17 20:39:40

I am interested in gathering eye tracking data and would like to create a Heroku app that uses this GazeTracking package (or similar) so I can capture and capture and store data for where people are looking on their screen for given images. After going through dozens of related answers on Stack Overflow and elsewhere, I am still unable to get this working correctly since I can't figure out how to access the user's web camera. Here is the GitHub repo I've got going right now. Is there a way to access the user's webcam for this project? Thanks.

Edit: I am using the buildpack https://github.com/heroku/heroku-buildpack-apt.git

Questioner
Mitchell Pudil
Viewed
0
Christoph Rackwitz 2020-12-18 11:47:22

Heroku apps run server-side. they're web apps. users interact with them through browsers.

if you wanted to access a user's webcam, that would have to happen through the browser. that requires WebRTC or similar APIs. that means serving a web page that contains client-side javascript (or other) code which accesses the user's webcam through the browser, and then sends a video feed (or single pictures) of that back to the server.

you can only directly access server resources inside the web app, not client-side resources.

if you wanted to do eye tracking browser-side, there's OpenCV.js which runs completely in the browser. I don't know if the required procedures for eye tracking have been ported to OpenCV.js but it's worth a look. you could do the analysis client-side and just send back heatmaps or lists of coordinates.