Hi, I'm Nate. I'm from Bangkok and I've been coding since I was 8! It's been a long journey.
This post is about lookat-we, a small library I just made. It uses your webcam to tell if you are looking left, center or right at the screen. Everything runs in the browser tab, and the video never leaves your device.
You can try the live demo here (needs a webcam): https://superhappycat.github.io/lookat-we/
I'll go through how it works step by step, with the real code. I'll also show a small trick I used to keep my face out of the demo.
Why I made it
A few months ago I entered a competition with a project called LookAtMe. For it I needed to know one thing in the browser: is the person looking left, center or right?
The main option was WebGazer.js. It's the best-known gaze library for the browser, and to be fair, it does more than mine. It gives you a full x, y gaze point. But it is GPLv3 (LGPLv3 for companies valued under $1M), and its official maintenance has ended.…