Home

Awesome

Kinect2 Socket Client

a javascript client library that can connect to a kinect2-socket application or load playback files. It runs in the browser or with nodejs.

example/simple.html : Simple Example

Usage

Browser

  1. include the kinect2-socket.min.js file located in the bin folder :
<script src="kinect2-socket.min.js"></script>
  1. initialize the tracker and a data proxy (ks.SocketStream or ks.Playback) :
var tracker = new ks.Tracker
tracker.addListener('user_in',  onKinectUserIn);
tracker.addListener('user_out', onKinectUserOut);

var kinectProxy = new ks.Playback(tracker);
kinectProxy.play('replay.json.gz', 30);

function onKinectUserIn(event) {
  console.log('> user in ' + event.body.id);
  bodies.push(event.body);
}

function onKinectUserOut(event) {
  console.log('< user out ' + event.body.id);
  bodies.splice(bodies.indexOf(event.body),1);
}

Nodejs / Browserify

Same as browser, except you import the library using

ks = require('src/kinect2-socket');

Dev

Thanks