In an application I am using webcam. TO access it I used webcam.js (https://pixlcore.com/). But when I opened it in eclipse it shows error as:Syntax error on token "catch", Identifier expected
. little code snippet:
var self = this;
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
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) { //here shows error
return self.dispatch('error', "Could not access webcam: " + err.name + ": " + err.message, err);
});
What is the reason and how to resolve it?