You can use the HTML5 getUserMedia() API, which is explained in this article: http://www.html5rocks.com/en/tutorials/getusermedia/intro/
Be careful: not all browsers support this (yet). For a detailed list of supporting browsers, take a look at this page: http://caniuse.com/#feat=stream