Skip to content

Instantly share code, notes, and snippets.

View seb-patron's full-sized avatar

Sebastian Patron seb-patron

  • Phoenix, AZ
View GitHub Profile
// Restrict camera resolution to 640x360
var constraints = window.constraints = { audio: false, video: { width: 640, height: 360 } };
var canvas = document.querySelector('canvas');
var filters = ['', 'grayscale', 'sepia', 'invert'], currentFilter = 0;
var video = document.querySelector('video');
//Accesses the user's camera and displays feed in video tag
navigator.mediaDevices.getUserMedia(constraints)
.then(function(stream) {
var videoTracks = stream.getVideoTracks();
<!DOCTYPE html>
<html>
<head>
<title>Selfie APP</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<style>
</style>
</head>
<body>
@seb-patron
seb-patron / run.js
Last active December 4, 2016 23:42
Serves a static file from a server. Requires the node-static module. Used in my Selfie App tutorial.
var static = require('node-static');
// https://www.npmjs.com/package/node-static
// Create a node-static server instance to serve the './public' folder
//
var file = new static.Server('./public');
require('http').createServer(function (request, response) {
request.addListener('end', function () {
file.serve(request, response);