Welcom to the Demos page for Binoculars
The demos need access to the device camera in order to function. Relax, it's not recording you... but you don't have to believe me, see for yourself
Installation
bower install binoculars
Then in your html file add:
<script src="bower_components/binoculars/dist/binoculars.js"></script>
done.
Alternatively, fetch it manually from github
Binoculars
Binoculars is a open source data capturing library written in javascript. It's main purpose is to allow easy access to all kinds of data. At the moment, it's main use case would be capturing data from <video> HTML5 elements.
The syntax used is oo (mimicking binoculars). Here we grab the brightness level from a video element.
var videoElem = document.getElementById("webcam"),
videoSrc = oo.video(videoElem);
videoSrc.getPermission().then(doStuff);
function doStuff() {
//brightness will be a number between 0 and 1
var brightness = videoSrc.getBrightness();
if(brightness < 0.1) {
// Do dark stuff...
}
}
Demos
Hot swapping stylesheets depending on the user's environmental lighting
(If it's dark, turn on the lights. If it's light, put your hand over the camera.)
Reading color and brightness data from <video>
Support or Contact
The library is brand new and all pull requests are greatly appreciated. If you have any feedback or questions, contact me at tryggvigy@gmail.com and I’ll get back to you as soon as possible.