Table of contents
Swift
Objective-C

This documentation is deprecated. It applies only to legacy version 9.x of Barcode Reader and must not be used for new development.

Please refer to the latest documentation and Migration Guide, which supersede this content.

How to get rid of the delay when opening the camera?

« Back to FAQ index

Version 10

1. Invoke loadWasm

Preload BarcodeReader or other specified module proactively to save time on the initial decoding by skipping the module loading at the time of instance creation.

await Dynamsoft.Core.CoreModule.loadWasm(["DBR"]);

2. skip camera inspection

You can bypass the camera selectionifSkipCameraInspection

	cameraEnhancer.ifSkipCameraInspection

3. Pre-open camera in advance

Run the following code before calling createInstance.

navigator.mediaDevices.getUserMedia({video: true}).then(mediaStream=>{
  mediaStream.getTracks().forEach((track) => {
    track.stop();
  });
}, err=>{});

Version 9

1. Invoke loadWasm in advance

Dynamsoft.DBR.BarcodeReader.loadWasm();

2. Pre-open the camera in advance

Run the following code before calling createInstance.

navigator.mediaDevices.getUserMedia({video: true}).then(mediaStream=>{
  mediaStream.getTracks().forEach((track) => {
    track.stop();
  });
}, err=>{});

3. Skip Camera inspection(use default camera)

scanner.ifSkipCameraInspection = true;

This page is compatible for:

Is this page helpful?

YesYes NoNo