Android Question Camera1_Preview event is sometimes triggered, sometimes not

jo1234

Active Member
Licensed User
Longtime User
Hi,

I use Erel's beautiful barcode scanning method (camEx, Mobile Vision API) to detect barcodes. The barcode is detected in the Camera1_Preview event, the scanning is stopped, the result is shown and the scanning continues to detect the next barcode.

To get faster reponses, I do not release the camera after each scan but only stop the preview (camEx.StopPreview).
After showing the result, I continue with camEx.StartPreview to scan the next barcode. That works in most cases on most devices.
However, I have instances (e.g. Galaxy Tab with Android 4.2.2, where the preview is started again and shows me the live video, however, the Camera1_Preview event is not triggered.
If I release the cam and initialize the cam again, the Camera1_Preview event is triggered again.

Any idea how it could happen that camEx.StartPreview restarts the video stream but not the Preview events?
As I said, the Preview event works in most cases and is not deactivated in the class module.

thanks,
Johannes
 

jo1234

Active Member
Licensed User
Longtime User
I have a scan view. When a barcode is detected, the preview is stopped, the scan view is hidden and the result view is shown. Then the user can either immediately continue to scan or do something else. In case he wants to continue to scan I want the camera to be quick and avoid to initialize the camera again because that takes a moment (unless it has to be done).

My solution at the moment is that after StartPreview I start a timer, which is disabled in the Preview event. In the rare cases that the Preview event does not fire after resuming the preview, the timer will initiate the camera again, which makes the Preview event fire again.

thanks,
Johannes
 
Upvote 0
Top