Utilizing BridJS api to implement JavaScript bindings for Tobii Gaze SDK
npm install gazejs
Download lastest Tobii Gaze SDK and copy "TobiiGazeCore64.dll" to working directory
var gazejs = require("gazejs")
var eyeTracker = gazejs.createEyeTracker(gazejs.TOBII_GAZE_SDK);//or gazejs.SR_EYELINK_SDK
var listener = {
onConnect:function(){
log.info("Library version: "+eyeTracker.getLibraryVersion());
log.info("Model name: "+eyeTracker.getModelName());
eyeTracker.start();
console.log("OnConnect");
},
onStart:function(){
console.log("OnStart");
},
onStop:function(){
console.log("OnStop");
},
onError:function(error){
console.log(error);
},
onGazeData:function(gazeData){
console.log(gazeData);
}
};
eyeTracker.setListener(listener);
eyeTracker.connect();
/*Stop eye tracking after 20 seconds*/
setTimeout(function(){
eyeTracker.release();
},20000);