This is a node (Windows-only) node module that can listen in for eye tracking events generated by the EyeX libraries installed on a Windows device.
npm install https://github.com/coughdrop/eyex.git
var eyex = require('eyex');
eyex.setup();
setInterval(function() {
var data = eyex.poll();
console.log(data.gaze_x + ", " + data.gaze_y);
}, 50);
We use this library as part of our Electron app for CoughDrop. In order for it to work,
we place the correct (x86 or x64) Tobii.EyeX.Client.dll
file in the root folder of our
app. For compiling, you can add the necessary resources from the lib
and include
folders
in the C++ SDK as well. You should find the EyeX SDKs at [http://developer.tobii.com/] but
make sure to consider the licensing options they offer before adopting the library. There are
some older versions of their libraries available with less restrictive licenses.
Also, I was having serious trouble getting the eyex.node file in the build/Release folder to work correctly with Electron, so it's currently ignoring that file and instead using the one in the root folder. That means the files need to be recompiled specifically for whatever version of Electron you use. I hope to fix this and stop embarrassing myself someday, but boy am I not a low-lever programmer.
Note that the init
function of eyex.cc
defines the method names that will be available to be
called from JavaScript via a node import, as well as their mapping to internal methods. While
additional methods may be available from the SDK, we keep the method called to a minimum here
to keep consistency across libraries, and because this code is not fun to maintain.
This library listens on both gaze and linger events, as defined in the EyeX SDK. I wasn't able
to figure out a clean way to register a listener, so instead the javascript is responsible
for polling the library for any updated events by calling var res = eyex.ping()
. The
library will always return the latest
result for each of the event types.
When this library is installed, it should automatically be used by gazelinger.js if also installed.
MIT