Skip to main content
Version: Release

API Docs (Javascript)

Overview

NameTypeDescription
SeesoClassSeeso is the main class for controlling and receiving gaze tracking and other related data.
CameraConfigurationClassCameraConfiguration contains the configuration for the camera.
GazeInfoClassGazeInfo contains information about the gaze position, tracking state, and eye movement state.
FaceInfoClassFaceInfo contains information about the detected face.
UserStatusOptionClassUserStatusOption contains options for tracking user status, such as drowsiness and attention.
TrackingStateconstant objectTrackingState is an enumeration that represents the current state of gaze tracking.
EyeMovementStateconstant objectEyeMovementState is an enumeration that represents the current state of eye movement.
CalibrationAccuracyCriteriaconstant objectCalibrationAccuracyCriteria is an enumeration that represents the desired level of accuracy for calibration.
onDebugFunctiononDebug is a callback function that provides performance monitoring information.
onGazeFunctiononGaze is a callback function that provides gaze tracking information.
onFaceFunctiononFace is a callback function that provides facial landmark and expression information.
onCalibrationNextPointFunctiononCalibrationNextPoint is a callback function that signals the program to move to the next calibration point.
onCalibrationProgressFunctiononCalibrationProgress is a callback function that provides progress information during calibration.
onCalibrationFinishedFunctiononCalibrationFinished is a callback function that provides the calibrated data after calibration is complete.
onAttentionFunctiononAttention is a callback function that provides information about the user's attention level.
onBlinkFunctiononBlink is a callback function that provides information about eye blinking.
onDrowsinessFunctiononDrowsiness is a callback function that provides information about the user's drowsiness level.

Seeso

class Seeso

Seeso is a class that generates gaze tracking data using the camera stream of a device.

Constructor
Seeso()
Function
initialize
deinitialize
startTracking
stopTracking
startCalibration
stopCalibration
startCollectSamples
openCalibrationPageQuickStart
openCalibrationPage
setCameraPosition
getCameraPosition
setCameraConfiguration
getCameraConfiguration
setFaceDistance
getFaceDistance
setMonitorSize
setScreenSize
getMonitorSize
setTrackingFps
fetchCalibrationData
uploadCalibrationData
setCalibrationData
getCalibrationData
setAttentionInterval
setAttentionRegion
getAttentionScore
checkMobile
getVersionName
showImage
hideImage
setDebugMode
addDebugCallback
removeDebugCallback
addGazeCallback
removeGazeCallback
addfacecallback
removefacecallback
addCalibrationNextPointCallback
removeCalibrationNextPointCallback
addCalibrationProgressCallback
removeCalibrationProgressCallback
addCalibrationFinishCallback
removeCalibrationFinishCallback
addAttentionCallback
removeAttentionCallback
addBlinkCallback
removeBlinkCallback
addDrowsinessCallback
removeDrowsinessCallback

Seeso()

Seeso()

The Seeso constructor doesn't take any arguments. To use gaze tracking, you need to first authenticate by calling the initialize function.

Example

const seeso = new Seeso()

initialize

async initialize(licenseKey, userStatusOption)

This asynchronous function authenticates the license key and starts the web assembly module. The UserStatusOption parameter enables users to choose whether to turn on or off the UserStatusModule.

ParametersTypeDescription
licenseKeyStringKey generated from SeeSo console page
userStatusOptionUserStatusOptionUserStatusOption is a value that enables or disables features related to UserStatus.
Retrun TypeDescription
InitializationErrorTypeThe initialize function returns the result of the initialization process.

Example

this.seeso = new Seeso();
const errorCode = await this.seeso.initialize(licenseKey, userStatusOption);
if (errorCode === InitializationErrorType.ERROR_NONE) {
// Initialization succeeded
} else {
// Initialization failed, show error message to user
}

deinitialize

async deinitialize()

The deinitialize function releases the memory used by the WebAssembly module, making it unavailable for use after this function is called.

Example

await this.seeso.deinitialize();
this.seeso = null;

startTracking

startTracking(stream)

startTracking is a function that begins Gaze tracking through a given stream.

ParametersTypeDescription
streamMediaStreamMediaStream is an object that streams media content such as video from a camera or other sources.
Retrun TypeDescription
booleanIndicates whether the function is operating normally or not.

Example

const stream = await navigator.mediaDevices.getUserMedia({'video': true});
this.started = await this.seeso.startTracking(stream);
if(this.started){
console.log(`started tracking.`)
}

stopTracking

 stopTracking()

stopTracking is a function that stops eye-tracking that was previously started by calling startTracking. It takes no arguments, and when stopTracking is called, the stream provided to startTracking will be released and the gaze tracking feature will be disabled.

Example

const stream = await navigator.mediaDevices.getUserMedia({'video': true});
this.started = await this.seeso.startTracking(stream);
if(this.started){
this.seeso.stopTracking();
}

startCalibration

startCalibration(calibrationPoints, criteria) 

startCalibration is a function that begins calibration to improve the accuracy of gaze tracking.

ParametersTypeDescription
calibrationPointsNumberThe number of calibration points to show.(1, 5, 6)
criteriaCalibrationAccuracyCriteriaThe calibration accuracy criteria.
Return TypeDescription
booleanWhether the function executed successfully.

Example

const calibrationPoints = 5;
const criteria = CalibrationAccuracyCriteria.HIGH;
const success = seeSo.startCalibration(calibrationPoints, criteria);

if (success) {
console.log("Calibration started successfully!");
} else {
console.log("Failed to start calibration.");
}

stopCalibration

stopCalibration()

stopCalibration is a function that stops the calibration process. It returns a boolean value indicating whether the function worked properly or not. The function does not require any input parameters.

Return TypeDescription
booleanIndicates success/fail.

Example

this.seeso.stopCalibration();
console.log('Calibration stopped.');

startCollectSamples

startCollectSamples() 

The startCollectSamples function initiates the calibration sample collection process, guiding the user to look at predefined targets. This function must be called to perform the calibration process for the UI targets the user is looking at.

Example

onCalibrationNextPoint(pointX, pointY) {
// set up UI for calibration target
...

// call startCollectSamples function to begin calibration process for the target
seeso.startCollectSamples();
}

openCalibrationPageQuickStart

static openCalibrationPageQuickStart(licenseKey, userId, redirectUrl, calibrationPoint)

The openCalibrationPageQuickStart function is used to quickly start the calibration process. It takes in the licenseKey, userId, redirectUrl, and calibrationPoint as parameters. The function then constructs a query string using these values, which is used to redirect the user to the calibration page.

ParameterTypeDescription
licenseKeyStringThe license key for the SDK developer
userIdStringThe user ID for the calibration
redirectUrlStringThe URL to redirect after calibration
calibrationPointNumberThe number of calibration points to display
danger

The function does not support mobile browser environments.

Example

const licenseKey = "my_license_key";
const userId = "user_id_1234";
const redirectUrl = "https://myapp.com/calibration/redirect";
const calibrationPoint = 5;
Seeso.openCalibrationPageQuickStart(licenseKey, userId, redirectUrl, calibrationPoint);

openCalibrationPage

static openCalibrationPage(licenseKey, userId, redirectUrl, calibrationPoint)

The openCalibrationPageStart function is used to quickly start the calibration process. It takes in the licenseKey, userId, redirectUrl, and calibrationPoint as parameters. The function then constructs a query string using these values, which is used to redirect the user to the calibration page.

ParameterTypeDescription
licenseKeyStringThe license key for the SDK developer
userIdStringThe user ID for the calibration
redirectUrlStringThe URL to redirect after calibration
calibrationPointNumberThe number of calibration points to display
danger

The function does not support mobile browser environments.

Example

const licenseKey = "my_license_key";
const userId = "user_id_1234";
const redirectUrl = "https://myapp.com/calibration/redirect";
const calibrationPoint = 5;
Seeso.openCalibrationPageStart(licenseKey, userId, redirectUrl, calibrationPoint);

setCameraPosition

setCameraPosition(cameraX, isCameraOnTop)

The setCameraPosition function is used to set the position of the camera.

ParameterTypeDescription
cameraXnumberThe x coordinate of the camera position in space.
isCameraOnTopbooleanIndicates whether the camera is on top or not
danger

The function does not support mobile browser environments.

Example

// Example usage of setCameraPosition function
const cameraX = 10;
const isCameraOnTop = true;
seeso.setCameraPosition(cameraX, isCameraOnTop);

getCameraPosition

getCameraPosition()

The getCameraPosition() function returns an object containing the current camera position.

Return TypeDescription
ObjectReturns an object with the current camera position, including isCameraOnTop and cameraX. Returns undefined if isCameraOnTop, cameraX is not defined.
danger

The function does not support mobile browser environments.

Example

const currentPosition = this.seeso.getCameraPosition();
console.log(`Current camera position: ${JSON.stringify(currentPosition)}`);

setCameraConfiguration

setCameraConfiguration(cameraConfig)

setCameraConfiguration is a function in the Seeso SDK that changes the camera configuration. It accepts a parameter of type CameraConfiguration, which is a class that contains information about the camera's properties.

ParameterTypeDescription
cameraConfigCameraConfigurationCameraConfiguration class instance that holds camera properties.
danger

Only available on mobile browsers.

Example

if(seeso.checkMobile()){
// create a new instance of CameraConfiguration
const cameraConfig = new CameraConfiguration('DeviceName', 'ModelName', 1920, 1080, 401, 401, 0, 0, 1.11, false);

// set the camera configuration
seeso.setCameraConfiguration(cameraConfig);
}

getCameraConfiguration

getCameraConfiguration()

getCameraConfiguration function is a SeeSo SDK function that fetches the currently configured camera information.

Return TypeDescription
CameraConfigurationcontaining the current camera properties.
danger

Only available on mobile browsers.

Example

if (this.seeso.checkMobile()) {
const cameraConfig = Seeso.getCameraConfiguration();
console.log(cameraConfig);
} else {
console.log('This function is only available on mobile browsers.');
}

setFaceDistance

setFaceDistance(faceDistance) 

The setFaceDistance function sets the distance between the user's face and the camera.

ParameterTypeDescription
faceDistancenumberThe distance between the user's face and the device in centimeters.
danger

The function does not support mobile browser environments.

Example

const faceDistance = 50;
this.seeso.setFaceDistance(faceDistance);

getFaceDistance

getFaceDistance()

The getFaceDistance function returns the distance between the user's face and the camera.

Return TypeDescription
numberThe distance between the user's face and the device in centimeters.
danger

The function does not support mobile browser environments.

Example

const currentDistance = myEyeTracker.getFaceDistance();
console.log(`The current face distance is ${currentDistance} cm`);

setMonitorSize

setMonitorSize(monitorInch)

The setMonitorSize function is used to set the user's monitor size in inches. This function takes in the monitor size as a parameter and sets it as a member variable.

ParametersTypeDescription
monitorInchnumberThe size of the monitor in inches.

Example

seeso.setMonitorSize(24);

setScreenSize

setScreenSize(widthMm, heightMm)

The setScreenSize function is used to set the user's screen size.

ParameterTypeDescription
widthMmnumberThe width of the screen in millimeters.
heightMmnumberThe height of the screen in millimeters.

Example

// Set the screen size to 80mm x 120mm
seeso.setScreenSize(80, 120);

getMonitorSize

getMonitorSize()

The getMonitorSize function returns the currently set monitor size in inches as a result.

Return TypeDescription
numberThe current monitor size in inches

Example

const monitorSize = seeso.getMonitorSize();
console.log(`Current monitor size: ${monitorSize} inches`);

setTrackingFps

setTrackingFps(fps) 

The setTrackingFps function is used to set the gaze tracking FPS (frame per second).

ParameterTypeDescription
fpsNumberThe FPS value to be set for gaze tracking.

Example

seeso.setTrackingFps(15);

fetchCalibrationData

async fetchCalibrationData(userId)

The fetchCalibrationData function takes a userId as an argument and fetches the user's calibration data.

ParameterTypeDescription
userIdstringThe ID of the user whose calibration data to fetch
Return TypeDescription
stringThe user's calibration data as string. Returns an empty string if the retrieval fails.
async function fetchUserCalibrationData(userId) {
const calibrationData = await seeso.fetchCalibrationData(userId);
if (calibrationData !== '') {
// calibration data exists, do something with it
} else {
// no calibration data exists for this user
}
}

uploadCalibrationData

async uploadCalibrationData(userId)

The uploadCalibrationData function takes a userId as an argument and uploads the user's calibration data.

ParameterTypeDescription
userIdstringThe user ID to upload the calibration data for.
Return TypeDescription
booleanReturns true if calibration data was successfully uploaded, false otherwise

Example

async function handleCalibrationUpload(userId) {
try {
const success = await seeso.uploadCalibrationData(userId);
if (success) {
console.log("Calibration data upload successful");
} else {
console.log("Calibration data upload failed");
}
} catch (error) {
console.log("Error uploading calibration data: ", error);
}
}
handleCalibrationUpload("user123");

setCalibrationData

async setCalibrationData(calibrationData)

setCalibrationData function is a function that sets the calibration data.

ParameterTypeDescription
calibrationDatastringThe calibration data to be set.

Example

async function setCalibration() {

// fetch calibration data from database or other source
const calibrationData = await fetchCalibrationData('user123');

// set the calibration data
seeso.setCalibrationData(calibrationData);
}

getCalibrationData

getCalibrationData()

The getCalibrationData function gets the current calibration data.

Return TypeDescription
stringThe current calibration data, if it exists.
nullIf no calibration data exists, returns null.

Example

const calibrationData = seeso.getCalibrationData();

// if calibration data exists, log it to the console
// otherwise, log an error message
if (calibrationData) {
console.log("Calibration data: " + calibrationData);
} else {
console.error("No calibration data found.");
}

setAttentionInterval

setAttentionInterval(interval)

The setAttentionInterval function adjusts the interval at which the onAttention callback function is called. The interval value is in seconds.

Example

// Set attention interval to 20 seconds
seeso.setAttentionInterval(20);

setAttentionRegion

setAttentionRegion(left, top, right, bottom)

The setAttentionRegion function is used to set the Attention region for the onAttention callback function.

ParameterTypeDescription
leftnumberThe left position of the attention region.
topnumberThe top position of the attention region.
rightnumberThe right position of the attention region.
bottomnumberThe bottom position of the attention region.

Example

// Set the region of attention as the rectangular area from (100, 100) to (500, 500)
seeso.setAttentionRegion(100, 100, 500, 500);

getAttentionScore

getAttentionScore()

The getAttentionScore() function retrieves the current user's attention score.

Return TypeDescription
floatThe current attention score of the user, as a float value.

Example

const attentionScore = seeso.getAttentionScore();
console.log(`Attention Score: ${attentionScore}`);

checkMobile

checkMobile()

The checkMobile function is used to determine whether the current browser being used is a mobile browser or not.

Return TypeDescription
booleanReturns true if the current browser is a mobile browser, else false.

Example

if (this.seeso.checkMobile()) {
console.log('Mobile Browser Detected');
} else {
console.log('Desktop Browser Detected');
}

getVersionName

static getVersionName()

The getVersionName function is a function that returns the version name of the current Seeso SDK.

Return TypeDescription
stringThe version name.

Example

const versionName = Seeso.getVersionName();
console.log(versionName); // logs the version name

showImage

showImage()

The showImage function is used to display the current camera stream.

danger

preview canvas must be included in the page for this function to work.

Example

const canvas = document.getElementById("preview");
if(canvas) {
seeso.showImage();
}

hideImage

hideImage()

The hideImage() function in SeeSo SDK is used to hide the current camera stream being displayed.

danger

preview canvas must be included in the page for this function to work.

Example

seeso.hideImage();

setDebugMode

setDebugMode(isDebug)

The setDebugMode function allows you to configure whether to print logs when in debug mode. By setting isDebug to true, logs associated with SeeSo will be displayed.

ParameterTypeDescription
isDebugbooleanDetermines whether logs associated with SeeSo will be displayed when in debug mode. If set to true, logs will be printed.

Example

function showSeeSoLogs() {
seeso.setDebugMode(true);
}

addDebugCallback

addDebugCallback(callback)

The addDebugCallback function in Seeso SDK takes a callback function as a parameter, which is composed of the onDebug(FPS, latency_min, latency_max, latency_avg) function.

ParameterTypeDescription
callbackfunctionThe function to call on debug.

Example

function addCalbacks(){
seeso.addDebugCallback(onDebug);
...
}

function onDebug(FPS, latency_min, latency_max, latency_avg) {
console.log(`FPS: ${FPS}`);
console.log(`Latency min: ${latency_min}`);
console.log(`Latency max: ${latency_max}`);
console.log(`Latency avg: ${latency_avg}`);
}

removeDebugCallback

removeDebugCallback(callback)

removeDebugCallback function is used to remove a debug callback function previously added by addDebugCallback.

ParameterTypeDescription
callbackfunctionThe function to call on debug.

Example

function removeCallbacks(){
seeso.removeDebugCallback(onDebug);
}

function onDebug(FPS, latency_min, latency_max, latency_avg) {
console.log(`FPS: ${FPS}`);
console.log(`Latency min: ${latency_min}`);
console.log(`Latency max: ${latency_max}`);
console.log(`Latency avg: ${latency_avg}`);
}

addGazeCallback

addGazeCallback(callback)

The addGazeCallback function takes a callback function in the form of onGaze(gazeInfo).

ParameterTypeDescription
callbackfunctionThe callback function. The function must be in the form of onGaze(gazeInfo).

Example

function addCallbacks() {
seeso.addGazeCallback(onGaze);
// ...
}

function onGaze(gazeInfo) {
console.log(`Timestamp: ${gazeInfo.timestamp}`);
console.log(`Gaze position (x, y): (${gazeInfo.x}, ${gazeInfo.y})`);
console.log(`Fixation position (x, y): (${gazeInfo.fixationX}, ${gazeInfo.fixationY})`);
console.log(`Left eye openness: ${gazeInfo.leftOpenness}`);
console.log(`Right eye openness: ${gazeInfo.rightOpenness}`);
console.log(`Tracking state: ${gazeInfo.trackingState}`);
console.log(`Eye movement state: ${gazeInfo.eyemovementState}`);
}

removeGazeCallback

removeGazeCallback(callback)

removeGazeCallback function removes the specified callback function from the gaze callback list. The gaze callback is registered by calling addGazeCallback function.

ParameterTypeDescription
callbackfunctionthe callback function to be removed from Seeso.

Example

// Define callback function
function onGaze(gazeInfo) {
console.log(gazeInfo);
}

// Add callback function
seeso.addGazeCallback(onGaze);

// Remove callback function
seeso.removeGazeCallback(onGaze);

addFaceCallback

addFaceCallback(callback)

addFaceCallback function is a method in SeeSo SDK that sets a callback function to be called when face detection is performed. The callback function should have the form of onFace(faceInfo).

ParameterTypeDescription
callbackfunctionthe function that will be called on face information

Example

function addCallbacks() {
seeso.addFaceCallback(onFace);
// other callback functions can also be added here
}

function onFace(faceInfo) {
console.log(`Face score: ${faceInfo.score}`);
console.log(`Face position: (${faceInfo.left}, ${faceInfo.top}) - (${faceInfo.right}, ${faceInfo.bottom})`);
}

removeFaceCallback

removeFaceCallback(callback)

The removeFaceCallback function is used to remove a callback function registered with addFaceCallback function.

ParameterTypeDescription
callbackFunctioncallback function to remove

Example

function removeCallbacks() {
seeso.removeFaceCallback(onFace);
}

function onFace(faceInfo) {
console.log(`Face score: ${faceInfo.score}`);
console.log(`Face position: (${faceInfo.left}, ${faceInfo.top}) - (${faceInfo.right}, ${faceInfo.bottom})`);
}

addCalibrationNextPointCallback

addCalibrationNextPointCallback(callback)

addCalibrationNextPointCallback function is used to register a callback function that will be invoked when the next calibration point is displayed during the calibration process. The callback should have the following form: onCalibrationNextPoint(pointX, pointY).

ParameterTypeDescription
callbackfunctionA callback function to receive next calibration point coordinates.

Example

function addCalibrationNextPointCallbackExample() {
seeso.addCalibrationNextPointCallback(onCalibrationNextPoint);
}

function onCalibrationNextPoint(pointX, pointY) {
console.log(`Next calibration point: (${pointX}, ${pointY})`);
}

removeCalibrationNextPointCallback

removeCalibrationNextPointCallback(callback)

removeCalibrationNextPointCallback function removes the callback function added using addCalibrationNextPointCallback function.

ParameterTypeDescription
callbackfunctionThe callback function that was previously registered using addCalibrationNextPointCallback.

Example

function onCalibrationNextPoint(pointX, pointY) {
console.log(`Next calibration point: (${pointX}, ${pointY})`);
}

// Add the callback
seeso.addCalibrationNextPointCallback(onCalibrationNextPoint);

// Remove the callback
seeso.removeCalibrationNextPointCallback(onCalibrationNextPoint);

addCalibrationProgressCallback

addCalibrationProgressCallback(callback)

addCalibrationProgressCallback is a function that registers a callback function of the form onCalibrationProgress(progress).

ParameterTypeDescription
callbackfunctionIt is a callback function in the form of onCalibrationProgress(progress).

Example

function addCalibrationCallbacks() {
seeso.addCalibrationProgressCallback(onCalibrationProgress);
}

function onCalibrationProgress(progress) {
console.log(`Calibration progress: ${progress}`);
}

removeCalibrationProgressCallback

removeCalibrationProgressCallback(callback)

The removeCalibrationProgressCallback function removes the registered callback function added by addCalibrationProgressCallback function.

ParameterTypeDescription
callbackfunction(progress)The parameter callback is the previously registered callback function using the addCalibrationProgressCallback function.

Example

const callback = (progress) => {
console.log(`Calibration progress: ${progress}`);
};

seeso.addCalibrationProgressCallback(callback);

.....

// Later, if you want to remove the callback:
seeso.removeCalibrationProgressCallback(callback);

addCalibrationFinishCallback

addCalibrationFinishCallback(callback)

addCalibrationFinishCallback function takes a callback function as a parameter in the form of onCalibrationFinished(calibrationData). This callback function is called when the calibration process is finished, and it receives an object calibrationData containing the calibration data as its parameter.

ParameterTypeDescription
callbackfunctionThe callback function to be called when calibration is finished.

Example

const calibrationFinishCallback = (calibrationData) => {
console.log(`Calibration finished with data: ${JSON.stringify(calibrationData)}`);
};

addCalibrationFinishCallback(calibrationFinishCallback);

removeCalibrationFinishCallback

removeCalibrationFinishCallback(callback)

The removeCalibrationFinishCallback function removes the previously registered callback function with addCalibrationFinishCallback function.

ParameterTypeDescription
callbackfunctionThe callback function to be removed. It should be the same function that was passed to addCalibrationFinishCallback.

Example

const myCalibrationFinishCallback = (calibrationData) => {
console.log('Calibration finished!');
console.log(calibrationData);
};

// Add the callback function to the list of calibration finish callbacks
myTracker.addCalibrationFinishCallback(myCalibrationFinishCallback);

// ...

// Remove the callback function from the list of calibration finish callbacks
myTracker.removeCalibrationFinishCallback(myCalibrationFinishCallback);

addAttentionCallback

addAttentionCallback(callback)

The addAttentionCallback function is used to register the ponAttention(timestampBegin, timestampEnd, score) function as a callback.

ParameterTypeDescription
callbackfunctionThe callback function to register with the SDK. It should be in the form of onAttention(timestampBegin, timestampEnd, score).

Example

const callback = (timestampBegin, timestampEnd, score) => {
console.log(`Attention event occurred between ${timestampBegin} and ${timestampEnd}. Score: ${score}`);
};

gazeDetector.addAttentionCallback(callback);

removeAttentionCallback

removeAttentionCallback(callback)

The removeAttentionCallback function removes the callback function registered with addAttentionCallback function.

ParameterTypeDescription
callbackfunctionThe function to be removed as a callback.

Example

const callback = (timestampBegin, timestampEnd, score) => {
console.log(`Attention: ${score} (from ${timestampBegin} to ${timestampEnd})`);
};

// Register the callback function
awrtc.addAttentionCallback(callback);

// Unregister the callback function
awrtc.removeAttentionCallback(callback);

addBlinkCallback

addBlinkCallback(callback)

addBlinkCallback function is used to register the onBlink(timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, rightOpenness) function as a callback.

ParameterTypeDescription
callbackfunctionThe callback function to register, in the form of onBlink(timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, rightOpenness).

Example

seeso.addBlinkCallback((timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, rightOpenness) => {
// Do something with the blink data
console.log(`Blink detected at ${timestamp}`);
});

removeBlinkCallback

removeBlinkCallback(callback)

The removeBlinkCallback function is used to remove a callback function registered by the addBlinkCallback function.

ParameterTypeDescription
callbackfunctionCallback function to remove, which was registered by addBlinkCallback() function.

Example

function onBlink(timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, rightOpenness) {
console.log(`Blink detected at ${timestamp}`);
}

seeso.addBlinkCallback(onBlink);

seeso.removeBlinkCallback(onBlink);

addDrowsinessCallback

addDrowsinessCallback(callback)

The addDrowsinessCallback function is used to register a callback function in the form of onDrowsiness(timestamp, isDrowsiness).

ParameterTypeDescription
callbackfunctionThe callback parameter is a function in the form of onDrowsiness(timestamp, isDrowsiness) that you want to register.

Example

// Define a callback function to be executed when drowsiness is detected
function onDrowsiness(timestamp, isDrowsiness) {
console.log(`Drowsiness detected at ${timestamp}. Drowsiness state: ${isDrowsiness}`);
}

// Register the callback function with the seeSo instance
seeSo.addDrowsinessCallback(onDrowsiness);

removeDrowsinessCallback

removeDrowsinessCallback(callback)

The removeDrowsinessCallback function removes the callback function registered with addDrowsinessCallback function.

ParameterTypeDescription
callbackfunctionThe callback function to be removed, which is the function registered with addDrowsinessCallback.

Example

function onDrowsiness(timestamp, isDrowsy) {
if (isDrowsy) {
console.log(`You are drowsy at ${timestamp}`);
} else {
console.log(`You are not drowsy at ${timestamp}`);
}
}

// Add the callback function
seeSo.addDrowsinessCallback(onDrowsiness);

// Later, remove the callback function
seeSo.removeDrowsinessCallback(onDrowsiness);

CameraConfiguration

class CameraConfiguration

The CameraConfiguration class is a class that contains camera configuration information used in Seeso. It is used in mobile browsers.

The CameraConfiguration object is set in Seeso using the setCameraConfiguration() function. Through this, Seeso can recognize the user's gaze accurately by determining the appropriate screen size, physical distance between the screen and the camera, and other factors.

VariableTypeDescription
deviceNamestringThe ID of the device referred to in code.
modelNamestringThe model name of the device.
resolutionWidthnumberThe width of the camera resolution.
resolutionHeightnumberThe height of the camera resolution.
ppiXnumberThe horizontal pixel density of the screen.
ppiYnumberThe vertical pixel density of the screen.
screenOriginXnumberThe horizontal size in millimeters of the physical distance between the camera and screen.
screenOriginYnumberThe vertical size in millimeters of the physical distance between the camera and screen.
fovnumberThe camera's field of view in radians.
cameraOnLongerAxisbooleanWhether the camera is positioned along the longer axis.

GazeInfo

class GazeInfo

GazeInfo is a class used in Seeso to contain gaze information, including the user's gaze coordinates and various states.

VariableTypeDescription
timestampnumberTimestamp of the gaze data in milliseconds
xnumberX coordinate of gaze point in screen space (When the upper-left corner of the screen is (0,0))
ynumberY coordinate of gaze point in screen space (When the upper-left corner of the screen is (0,0))
fixationXnumberX coordinate of fixation point in screen space (When the upper-left corner of the screen is (0,0))
fixationYnumberY coordinate of fixation point in screen space (When the upper-left corner of the screen is (0,0))
leftOpennessnumberOpenness value of the left eye (0.0~1.0)
rightOpennessnumberOpenness value of the right eye (0.0~1.0)
trackingStateTrackingStateState of the gaze tracker
eyemovementStateEyeMovementStateState of the eye movement

FaceInfo

class FaceInfo

FaceInfo is a class in Seeso that contains information about the user's face, including the position, size, and orientation. It is used to track the user's facial movements and expressions.

VariableTypeDescription
timestampnumberTime when the face information was captured
scorenumberThe score indicating the accuracy of the face recognition
leftnumberThe x-coordinate of the left-most point of the face rectangle
topnumberThe y-coordinate of the top-most point of the face rectangle
rightnumberThe x-coordinate of the right-most point of the face rectangle
bottomnumberThe y-coordinate of the bottom-most point of the face rectangle
pitchnumberThe pitch of the face in degrees
yawnumberThe yaw of the face in degrees
centerXnumberThe distance between the center of the face and the camera in millimeters (mm) along the x-axis
centerYnumberThe distance between the center of the face and the camera in millimeters (mm) along the y-axis
centerZnumberThe distance between the center of the face and the camera in millimeters (mm) along the z-axis

UserStatusOption

class UserStatusOption

The UserStatusOption class is a class that contains information about the user's status in Seeso.

This class is used when calling the initialize function, and depending on the variables passed, it determines whether to use the attention, blink, and drowsiness functions. These three functions are used to inquire about usage when performing more operations to create them.

Therefore, the UserStatusOption class is used to appropriately configure the functions necessary for tracking and analyzing the user's status in Seeso.

ParameterTypeDescription
isUseAttentionbooleanWhether to use attention tracking functionality
isUseBlinkbooleanWhether to use blink tracking functionality
isUseDrowsinessbooleanWhether to use drowsiness tracking functionality

TrackingState

export const TrackingState = Object.freeze({
SUCCESS: 0,
LOW_CONFIDENCE: 1,
UNSUPPORTED: 2,
FACE_MISSING: 3,
});

The TrackingState constant object is an enumeration that represents the face tracking state in Seeso. These tracking states are used in the GazeInfo object.

  • SUCCESS indicates a successfully tracked state.
  • LOW_CONFIDENCE indicates a tracked state with low confidence.
  • UNSUPPORTED indicates an unsupported tracking state.
  • FACE_MISSING indicates a state where a face is not detected.

EyeMovementState

export const EyeMovementState = Object.freeze({
FIXATION: 0,
SACCADE: 2,
UNKNOWN: 3,
});

EyeMovementState is an enumeration in Seeso that represents the state of eye movement. These eye movement states are used in the GazeInfo object.

  • FIXATION indicates that the pupil is stationary.
  • SACCADE indicates rapid movement of the pupil.
  • UNKNOWN indicates an unknown state of eye movement.

CalibrationAccuracyCriteria

export const CalibrationAccuracyCriteria = Object.freeze({
DEFAULT: 0,
LOW: 1,
HIGH: 2,
});

CalibrationAccuracyCriteria is an enum constant object used as a parameter for the startCalibration function. The startCalibration function performs calibration to accurately track the user's gaze information, and the CalibrationAccuracyCriteria parameter can be used to set the accuracy criteria for the calibration. This parameter can be set to one of DEFAULT, LOW, or HIGH, which represent the default, low, and high accuracy criteria, respectively.

onDebug

onDebug(FPS, latency_min, latency_max, latency_avg)

The onDebug function is one of the callback functions used in Seeso that provides performance monitoring information. It is called every time the onGaze function is executed and receives current frame rate (FPS), minimum and maximum latency time (latency_min, latency_max), and average latency time (latency_avg) as arguments. This function can be used to monitor and debug the performance of the program.

onGaze

onGaze(gazeInfo)

The onGaze function is one of the callback functions used in Seeso. This function takes a GazeInfo object as an argument.

onFace

onFace(faceInfo)

The onFace function is one of the callback functions used in Seeso. This function takes a FaceInfo object as an argument.

onCalibrationNextPoint

onCalibrationNextPoint(pointX, pointY)

The onCalibrationNextPoint function is one of the callback functions used in Seeso. This function is used to signal the program to move to the next point during the calibration process. In other words, this function is responsible for notifying the program to move to the next calibration point after the measurement is completed at the current calibration point. This function is automatically called during the calibration process and does not need to be called directly by the developer.

onCalibrationProgress

onCalibrationProgress(progress)

The onCalibrationProgress function is one of the callback functions used in Seeso. This function is used to inform the program of the progress of the calibration process. In other words, this function tracks the progress of the current target during the calibration process and provides that information to the developer. This function is automatically called during the calibration process and does not need to be called directly by the developer. The function takes a progress argument that represents the current calibration progress, which has a value between 0.0 and 1.0.

onCalibrationFinished

onCalibrationFinished(calibrationData)

The onCalibrationFinished function is one of the callback functions used in Seeso. This function is called when the calibration process is completed. It receives a CalibrationData object that contains the calibrated data. The CalibrationData object stores the parameters used for eye tracking in Seeso. Therefore, this function allows developers to obtain the extracted parameters from the calibration process. This function is automatically called when the calibration process is completed and does not need to be called directly by the developer.

onAttention

onAttention(timestampBegin, timestampEnd, score)

The onAttention function is one of the callback functions used in Seeso. It is used to track the user's attention level and provides detailed information about the tracked attention level. The function takes three parameters as input: timestampBegin, timestampEnd, and score.

The timestampBegin parameter represents the time when the attention tracking started, while timestampEnd represents the time when the attention tracking ended. The score parameter represents the tracked attention level, and its value is a float between 0 and 1.

onBlink(timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, rightOpenness)

The onBlink function is one of the callback functions used in Seeso. This function is used to track eye blink information. The function provides detailed information about the tracked eye blink. It takes six parameters as input: timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, and rightOpenness.

The timestamp parameter indicates the time when the eye blink was detected. The isBlinkLeft and isBlinkRight are Boolean variables that indicate whether the left and right eye blinked, respectively. The isBlink parameter is also a Boolean variable that indicates whether both eyes blinked simultaneously. The leftOpenness and rightOpenness are float variables that represent the degree of openness of the left and right eyes, respectively.

This function enables the tracking and analysis of eye blink information and the analysis of the eye state.

onDrowsiness

onDrowsiness(timestamp, isDrowsiness, intensity)

The onDrowsiness function is one of the callback functions used in Seeso. This function is used to track the user's drowsiness state. The function provides detailed information about the tracked drowsiness state. It takes two parameters as input: timestamp and isDrowsiness.

The timestamp parameter indicates the time when the drowsiness state was detected, and the isDrowsiness parameter is a Boolean variable that indicates whether the user is currently drowsy or not. This function enables the tracking of the user's drowsiness state and allows appropriate actions to be taken by the program.

The intensity parameter in the onDrowsiness function represents the intensity or level of drowsiness detected. It is a floating-point value ranging from 0 to 1.

The intensity value provides additional information about the severity or strength of the drowsiness state. A value of 0 indicates no drowsiness or low drowsiness intensity, while a value of 1 represents high drowsiness intensity.