import 'regenerator-runtime/runtime'; // npm module import SeeSo, {InitializationErrorType,UserStatusOption} from 'seeso'; let videoStream = null; const licenseKey = 'input your key'; // Issue license key! -> https://console.seeso.io // gaze callback. function onGaze(gazeInfo) { // do something with gaze info. console.log('onGaze', gazeInfo) } function onBlink(timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, rightOpenness) { console.log('Blink! ',timestamp, isBlinkLeft, isBlinkRight, isBlink, leftOpenness, rightOpenness) } async function main() { videoStream = await navigator.mediaDevices.getUserMedia({'video': true}); const seeSo = new SeeSo(); /** * set monitor size. default: 16 inch. * set face distance. default: 30 cm. * set camera position. default: * camera x: right center * cameraOnTop: true */ const option = new UserStatusOption(false, true, false); const errCode = await seeSo.initialize(licenseKey, option); // callback when init failed.) if (errCode === InitializationErrorType.ERROR_NONE) { seeSo.setMonitorSize(16); seeSo.setFaceDistance(50); seeSo.setCameraPosition(window.outerWidth / 2, true); seeSo.addGazeCallback(onGaze); seeSo.addBlinkCallback(onBlink); seeSo.startTracking(videoStream); } } (async () => { await main(); })()