As I asked previously that I am doing a webcam application.
I can detect the browser supports webcam or not using getUserMedia as navigator.webkitGetUserMedia
. But Some time the computer doesn't have webcam then too usermedia is true. I am using webcam.js framework for it.
How to get to know that the computer not supported webcam before processing webcam application code?
this.mediaDevices.getUserMedia({
"audio": false,
"video": this.params.constraints || {
mandatory: {
minWidth: this.params.dest_width,
minHeight: this.params.dest_height
}
}
})
.then( function(stream) {
// got access, attach stream to video
alert(12);
video.src = window.URL.createObjectURL( stream ) || stream;
self.stream = stream;
self.loaded = true;
self.live = true;
self.dispatch('load');
self.dispatch('live');
self.flip();
})
.catch( function(err) {
return self.dispatch('error', "Could not access webcam: " + err.name + ": " + err.message, err);
});
If webcam is not there then catch block is catching but how to catch manually?