notes/Basic Webcam Video Stream to Canvas with Effects FX-ayKus0Sa.html
<!DOCTYPE html>
<html>
<head>
    <!--Based on Code from http://blog.teamtreehouse.com/accessing-the-device-camera-with-getusermedia-->
  <title>Basic Webcam Video Stream to Canvas - with Effects - FX</title>
    <style>
    body {
      background: #F7F7F7;
      margin: 0;
      padding: 0;
    }

    #video-container {
      margin: 2em auto 0;
      width: 500px;
      padding: 2em;
      background: white;
      -webkit-box-shadow: 0 1px 10px #D9D9D9;
      -moz-box-shadow: 0 1px 10px #D9D9D9;
      -ms-box-shadow: 0 1px 10px #D9D9D9;
      -o-box-shadow: 0 1px 10px #D9D9D9;
      box-shadow: 0 1px 10px #D9D9D9;
    }

        #camera-stream {
            //-webkit-filter: sepia(1);
            //-webkit-filter: blur(3px);
            //-webkit-filter: grayscale(1);
            //-webkit-filter: sepia(1);
            //-webkit-filter: brightness(2.5);
            //-webkit-filter: contrast(5);
            //-webkit-filter: hue-rotate(125deg);
            //-webkit-filter: invert(1);
            //-webkit-filter: saturate(3);
            //-webkit-filter: opacity(0.3);   
        }
    </style>
</head>
<body>
  <div id="video-container">
    <video id="camera-stream" width="500" autoplay></video>
  </div>
    <script>
        window.onload = function() {
        
          // Normalize the various vendor prefixed versions of getUserMedia.
          navigator.getUserMedia = (navigator.getUserMedia ||
                                    navigator.webkitGetUserMedia ||
                                    navigator.mozGetUserMedia ||
                                    navigator.msGetUserMedia);
        
            if (navigator.getUserMedia) {
              // Request the camera.
              navigator.getUserMedia(
                // Constraints
                {
                  video: true
                },
        
                // Success Callback
                function(localMediaStream) {
                    // Get a reference to the video element on the page.
                    var vid = document.getElementById('camera-stream');
        
                    // Create an object URL for the video stream and use this 
                    // to set the video source.
                    vid.src = window.URL.createObjectURL(localMediaStream);
        
                },
        
                // Error Callback
                function(err) {
                  // Log the error to the console.
                  console.log('The following error occurred when trying to use getUserMedia: ' + err);
                }
              );

            } else {
              alert('Sorry, your browser does not support getUserMedia');
            }

        }   
    </script>
</body>
</html>

syntax highlighted by Code2HTML, v. 0.9.1