html5-qrcode icon indicating copy to clipboard operation
html5-qrcode copied to clipboard

[Feature Request] Stop Camera method in Html5QrcodeScanner

Open ronyevernaes opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. After scanning a code or closing / hiding the element where the scanner is placed, there should be a way to stop the camera usage in the browser programatically.

Describe the solution you'd like A method to stop the camera should be available in the Html5QrcodeScanner.

Describe alternatives you've considered The same way as methods pause and resume are available, methods to stop and start the camera usage could be available.

ronyevernaes avatar Sep 20 '23 14:09 ronyevernaes

just destroy the html5-qrcoce instance and you are good to go.

ROBERT-MCDOWELL avatar Nov 02 '23 06:11 ROBERT-MCDOWELL

For anyone else wondering how to destroy the instance, just do something like scanner = null; to signal to the garbage collector that it is not being used anymore.

I think it would be better to have an explicit method to destroy the listeners, however, because the garbage collector is doing this as a side effect and not an explicit/immediate action.

parker-codes avatar Nov 09 '23 19:11 parker-codes