xxxxxxxxxx
var successCallback = function(error) {
// user allowed access to camera
};
var errorCallback = function(error) {
if (error.name == 'NotAllowedError') {
// user denied access to camera
}
};
navigator.mediaDevices.getUserMedia(constraints)
.then(successCallback, errorCallback);