liveBook · Manning

Handtrack.js

As explained in Web Components in Action

Handtrack.js is a JavaScript library that detects and tracks hands in video imagery using a machine-learning model.

handtrack.js detects hands in browser video by applying a trained machine-learning model through TensorFlow.js. Its complexity stays behind a small Web Component that reads from a video element and can render tracking results to a canvas. section 15.4

A practical integration combines three pieces:

  • Load the distributed handtrack.js script separately because the distributed library is not a module. section 15.4
  • Expose detected hand locations through a Custom Event so other components can consume point coordinates without knowing the model internals. section 15.4

Hand tracker in a browser component

A custom element can request camera input, display a refreshed canvas, and listen for onHandLocation. The same component can be layered with another interface, such as a Web Harp that reacts to tracked hands.

How Web Components in Action covers it

How deep it goes
Explains model training only briefly, then demonstrates configuration, loading, video detection, canvas output, and event integration.
Examples
Uses a hand-tracker demo page and a Web Harp interface that combines hand tracking with interactive strings.
What it assumes
Assumes familiarity with JavaScript modules, custom elements, video, canvas, and event listeners while leaving model training details secondary.
What you can do after
Build a browser hand-tracking component and consume its detected coordinates through a named Custom Event.
How it connects
Connects TensorFlow.js, machine learning, Web Components, Custom Events, video elements, and canvas rendering.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Components in Action. The section links point to the parts of the book it draws on.