Created
August 11, 2012 11:47
-
-
Save k-kinzal/3324014 to your computer and use it in GitHub Desktop.
Use media.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get permission | |
navigator.webkitGetUserMedia({video:true}, function(stream) { | |
// allow permission | |
// call capture | |
capture(stream, function(blob) { | |
// get blob and blob to image src | |
//-- Webkit browser is window.webkitURL.createObjectURL | |
document.querySelector('img').src = window.webkitURL.createObjectURL(blob); | |
}); | |
}, function(e) { | |
// permission denied or not connect device | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment