在 Heroku 中访问用户的网络摄像头

Accessing a user's webcam in Heroku

我对收集眼球追踪数据很感兴趣,并想创建一个使用此 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 的 Heroku 应用程序,这是我现在要使用的 GitHub 存储库。有没有办法访问该项目的用户网络摄像头?谢谢

编辑:我正在使用构建包 https://github.com/heroku/heroku-buildpack-apt.git

Heroku 应用程序 运行 服务器端。他们是网络应用程序。用户通过浏览器与他们互动。

如果您想访问用户的网络摄像头,则必须通过浏览器进行。需要 WebRTC 或类似的 API。这意味着提供一个包含客户端 javascript(或其他)代码的网页,该代码通过浏览器访问用户的网络摄像头,然后将其视频源(或单张图片)发送回服务器。

您只能直接访问 Web 应用程序内部的服务器资源,不能访问客户端资源。

如果您想在浏览器端进行眼动追踪,OpenCV.js 运行 完全在浏览器中。我不知道眼睛跟踪所需的程序是否已移植到 OpenCV.js,但值得一看。您可以在客户端进行分析,然后发回热图或坐标列表。