BlinkID / blinkid-in-browser

BlinkID In-browser SDK for WebAssembly-enabled browsers.
https://microblink.com/blinkid
59 stars 30 forks source link

Error thrown in FrameCapture.captureFrame is not handled #46

Open sveres opened 3 years ago

sveres commented 3 years ago

Hi,

This issue relates to https://github.com/BlinkID/blinkid-in-browser/issues/45 and because of that, we cannot handle/react to the error properly.

How to reproduce the the error, is not yet completely clear to us, we speculate that there might be a timing/rendering/api issue with videoWidth and the play() event. However we would like to at least handle the issue more gracefully, rather than throwing an unhandled error.

We see the following unhandled errors with the message:

Uncaught (in promise): Uncaught (in promise): IndexSizeError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0.

We get this only in case we use the VideoRecognizer.

https://github.com/BlinkID/blinkid-in-browser/blob/6b2af6dcaba91006de70b7ec7a8b2905e987fa9e/src/MicroblinkSDK/FrameCapture.ts#L76