LostInBrittany / granite-qrcode-scanner

A webcomponent to scan a QR Code
MIT License
22 stars 7 forks source link

'continuous' doesn't stop when granite-qrcode-scanner is disconnected #19

Open davidmaxwaterman opened 5 years ago

davidmaxwaterman commented 5 years ago

If the element with continuous set is disconnected, some internals of the scanner aren't stopped, and there is continuous console output.

I suggest adding a disconnectedCallback() to set the active and continuous options to false - that seems to work in my experiments, but perhaps there's a 'better' way if you have more knowledge of the internals. For now, I can add these to the disconnectedCallback() in my element (since it is also removed).

LostInBrittany commented 5 years ago

Going to look at that, thanks :)

On Wed, Sep 11, 2019 at 9:22 AM Max Waterman notifications@github.com wrote:

If the element with continuous set is disconnected, some internals of the scanner aren't stopped, and there is continuous console output.

I suggest adding a disconnectedCallback() to set the active and continuous options to false - that seems to work in my experiments, but perhaps there's a 'better' way if you have more knowledge of the internals. For now, I can add these to the disconnectedCallback() in my element (since it is also removed).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LostInBrittany/granite-qrcode-scanner/issues/19?email_source=notifications&email_token=AAFRLTAWAM3Z37LUQYAU36TQJCMFBA5CNFSM4IVQHS2KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HKUJAUA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFRLTE63P5XKRXWSGERAD3QJCMFBANCNFSM4IVQHS2A .

syampillai commented 4 years ago

Is this issue resolved? I think, in order to switch off the camera, the stream should be closed. stream.getTracks().forEach( t=> { t.stop(); });

davidmaxwaterman commented 4 years ago

I'm not able to look at this in the foreseeable future.