Call camera.close() when not using Camera service
Is your feature request related to a problem? Please describe. It was not clear to me how to stop the Camera, after using an Uppload instance to take a webcam photo; the camera light stayed on and subsequent instances of Uppload didn't work correctly (services un-clickable).
Describe the solution you'd like I got lucky; in an unrelated Issue's code-snippet, I saw how another user was stopping the camera: https://github.com/elninotech/uppload/issues/113#issuecomment-613950372. Maybe a stripped-down version of @saqueib's code could go into the docs?
Describe alternatives you've considered ...
Additional context I think that's it. But maybe I missed it in the docs somewhere else?
Thanks, this is a neat solution.
well, I'm still having some issues with the subsequent modals not working after a success. It's clearly a bigger architectural problem where I'm doing something dumb/wrong. Will close this.
Let's keep this open and try and see how we can make sure the camera service auto-stops and works reliably in successive instances/opens.
I might have figured out my problem; I made a mistake, as I expected. I am (for now) using React, and I was modifying the sample code on CodeSandbox here. In attempting to move away from a class-component, I refactored a bit; I also put the upload = new Uppload() and the upload.use() statements inside the functional component.
Today I realized my mistake, pulled all of that out of the function, and it seems to work repeatedly. This plus the explicit camera.stop() in the on-close listener (a la #113), seems to have done the trick.
Thanks for sharing! I think the camera.stop() should definitely be built-in when a user navigates away from the camera service or closes the modal. I thought I already added that, but since I didn't, I'll keep this issue open until I make that update shortly.
@AnandChowdhary I think your code is indeed in place, but a little bug causes the camera to reopen after the modal is closed. I've proposed a solution in #345 - let me know if this is acceptable!