close webcam auto. after clicking picture (#1816)

Co-authored-by: Jeffrey Warren <jeff@unterbahn.com>
This commit is contained in:
Vivek Singh
2021-02-19 21:12:59 +05:30
committed by GitHub
parent 72175fa789
commit e08b706497

View File

@@ -52,9 +52,10 @@ function setInputStepInit() {
video.play();
};
document.getElementById('capture').addEventListener('click', function(stream){
document.getElementById('capture').addEventListener('click', function(){
context.drawImage(video, 0, 0, 400, 300);
options.onTakePhoto(canvas.toDataURL());
setTimeout(stopStream(stream),1); // wait for 1 second before closing webcam so that image loads properly
});
document.getElementById('close').addEventListener('click', function () {