Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question / Feature Request: Is there a way to detect when the processImage() (background task) method has finished executing? #106

Open
jamesbarrett95 opened this issue Mar 7, 2023 · 3 comments

Comments

@jamesbarrett95
Copy link

jamesbarrett95 commented Mar 7, 2023

Problem Statement:

After successfully capturing the the user's documents in our application, we dispose of all the video resources, destroy the component from the DOM, and redirect to a 'confirmation' screen which displays a preview of what Blink ID has captured. We display a retry button at the bottom of that confirmation screen which, once clicked, will navigate back and re-initialize the component which is responsible for creating a new VideoRecognizer.

Our problem is that if the retry button is clicked whilst the processImage() background task is executing, then we receive an error when attempting to initialize a new VideoRecognizer, which causes our application to break.

Question / Feature Request

Is there a way to 'wait' until the async processImage() task has finished executing such that we can control when the user is allowed to hit retry?

Additional Information

Version
"@microblink/blinkid-in-browser-sdk": "^5.18.0"

Error when trying to recreate a new VideoRecognizer, immediately after capturing a document:
image

@jamesbarrett95 jamesbarrett95 changed the title Question: Is there a way to detect when the asynchronous processImage call has finished processing? Question / Feature Request: Is there a way to detect when the asynchronous processImage() call has finished executing? Mar 7, 2023
@jamesbarrett95 jamesbarrett95 changed the title Question / Feature Request: Is there a way to detect when the asynchronous processImage() call has finished executing? Question / Feature Request: Is there a way to detect when processImage() (background task) method has finished executing? Mar 7, 2023
@jamesbarrett95 jamesbarrett95 changed the title Question / Feature Request: Is there a way to detect when processImage() (background task) method has finished executing? Question / Feature Request: Is there a way to detect when the processImage() (background task) method has finished executing? Mar 7, 2023
@ivancuric
Copy link
Collaborator

ivancuric commented Mar 21, 2023

There is currently no way to see if a frame is still being processed, but it can be added in a future release.

This error triggers if the video is still playing, as it checks for its .paused property, so that's one way you can check.

Another one is to wait for the VideoRecognizer.startRecognition() to resolve as it uses processImage() under the hood.

@jamesbarrett95
Copy link
Author

jamesbarrett95 commented Mar 23, 2023

Thanks for the reply @ivancuric.

Another one is to wait for the VideoRecognizer.startRecognition() to resolve as it uses processImage() under the hood.

Does it? Because once it's resolved, it seems as if there are still some background tasks executed by Blink ID, hence why the question was asked in the first place. See screenshot 1 which illustrates a browser log containing the output of BlinkIdCombinedRecognizer.getResult() followed by some network calls, initiated by Blink ID. See screenshot 2, which illustrates the corresponding Blink ID network call, initiated by processImage.

Screenshot 1:
image

Screenshot 2:
image

@ivancuric
Copy link
Collaborator

It should: https://github.com/BlinkID/blinkid-in-browser/blob/master/src/MicroblinkSDK/VideoRecognizer.ts#L712-L728.

Thanks for the feedback, I'll try to see what's going on.

Is there any chance you could provide a minimal reproduction sample on a repository?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants