I am trying to take a snapshot with the laptop camera.
In used to work perfectly, but now I have an error in my console:
ERROR Error: Uncaught (in promise): TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.
Here is my code (component.ts):
public ngAfterViewInit() {
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({ video: true }).then(stream => {
this.video.nativeElement.src = window.URL.createObjectURL(stream);
this.video.nativeElement.play();
});
}
}