jiahansu / GazeJS

GazeJS project hosts an implementation of the JavaScript bindings for Tobii Gaze SDK
Other
28 stars 7 forks source link

GazeJS

Utilizing BridJS api to implement JavaScript bindings for Tobii Gaze SDK

Video Demonstration

EyeMining for Web

Installation

npm install gazejs

How to use

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);