Closed JCown closed 3 years ago
Fixed in dev branch.
https://github.com/dynamsoft-rd-0/dbrjs-mass-samples/blob/master/destroyDuringShow/fixed.html
While throwing The BarcodeScanner instance has been destroyed
, dbrjs will release camera.
Merged to the next official version.
Hey, I'm using version 8.1.2 of https://www.npmjs.com/package/dynamsoft-javascript-barcode
Having a valid initialization and working scanner I've noticed the following (edge-case) error: Let's say we have a SPA application, and a view/page that displays fullpage barcode scanner. On view/page leave we call
BarcodeScanner.destroy()
method (for example in router guard in case of Vue framework) to destroy scanner and close video streams. An example of page leave would be simply using browser/device navigation back button.If user redirects away from the page/view during barcode scanner initialization (speaking more precisely - during execution of
BarcodeScanner.show()
method) then the following error is thrown:and video stream is not closed correctly (a browser indicator that this page is using or camera/microphone is still being displayed).
Example code to reproduce this issue:
BarcodeScanner.show()
should perform an extra check for already destroyed scanner and correctly close video stream in such case.