Accessing a user's webcam in Heroku

雨燕双飞 提交于 2021-02-11 15:48:09

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/65348022/accessing-a-users-webcam-in-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!