brownhci / WebGazer

WebGazer.js: Scalable Webcam EyeTracking Using User Interactions
https://webgazer.cs.brown.edu
Other
3.54k stars 536 forks source link

a param for setting the deviceId of the chosen webcam #228

Closed hanadi92 closed 3 years ago

hanadi92 commented 3 years ago

I want to use the built Webgazer.js without making any changes in the src. Therefore, I am looking for a way to set a param that would take the camera deviceId that I set in a cookie before the webgazer is loaded. I tried to set: webgazer.params.camConstraints.video.deviceId = ""; and I don't know why but it's not taken in the begin() function. Is this possible? or do I have to tweak the sources?

hanadi92 commented 3 years ago

I ended up using await on setting the deviceId living in webgazer.params.camConstraints.video before firing the begin() and it works. However, there exist a function called setCameraConstraints, which is documented in the API docs which is no where called and I assume it's a deprecated function because the default used tracker facemesh has no reset function implemented. Which was misleading for me.