Barcode Capture

Defined under the namespace Scandit.Datacapture.Barcode

interface BarcodeCaptureLoaderOptions

Added in version 6.13.0

highEndBlurryRecognition?: boolean

Added in version 6.13.0

Whether to generate and use high quality barcode blurry recognition data, resulting in improved localization and scanning performance of extremely challenging 1D codes. If enabled, more time is spent to initialize (load or generate if needed) the needed data and for the processing of each video frame.

Enabling this option is not recommended unless really needed due to its high performance impact.

class BarcodeCapture : DataCaptureMode

Added in version 6.13.0

Capture mode for single barcode scanning. Learn more on how to use barcode capture in our Get Started With Barcode Capture guide. This capture mode uses the barcode scanning capability.

forContext(context, settings)
static forContext(context: DataCaptureContext | null,
        settings: BarcodeCaptureSettings): Promise<BarcodeCapture>

Added in version 6.13.0

Construct a new barcode capture mode with the provided context and settings. When the context is not null, the capture mode is automatically added to the context.

isEnabled(): boolean

Added in version 6.13.0

Get DataCaptureMode. See DataCaptureMode.isEnabled().

setEnabled(enabled: boolean): Promise<void>

Added in version 6.13.0

Set DataCaptureMode. See DataCaptureMode.setEnabled().

applySettings(settings: BarcodeCaptureSettings): Promise<void>

Added in version 6.13.0

Asynchronously applies the new settings to the barcode scanner. If the scanner is currently running, the task will complete when the next frame is processed, and will use the new settings for that frame. If the scanner is currently not running, the task will complete as soon as the settings have been stored and won’t wait until the next frame is going to be processed.

setFeedback(feedback: BarcodeCaptureFeedback): Promise<void>

Added in version 6.18.0

Set the feedback and waits for DataCaptureMode.context to be notified.

feedback: BarcodeCaptureFeedback

Added in version 6.13.0

Instance of BarcodeCaptureFeedback that is used by the barcode scanner to notify users about Success and Failure events.

The default instance of the Feedback will have both sound and vibration enabled. A default beep sound will be used for the sound.

Deprecated since version 6.18: The synchronous feedback setter has been deprecated in favor of setFeedback() async method.


Please note that on some browsers the autoplay of media elements is not guaranteed and may need a user interaction first. More info here (chrome) and here (webkit)

To change the feedback emitted, the BarcodeCaptureFeedback can be modified as shown below, or a new one can be assigned.

const barcodeCapture = ...;
const feedback = SDCBarcode.BarcodeCaptureFeedback.default;
feedback.success = new SDCCore.Feedback(SDCCore.Vibration.defaultVibration, null);
await barcodeCapture.setFeedback(feedback);
addListener(listener: BarcodeCaptureListener): void

Added in version 6.13.0

Adds the listener to this barcode capture instance.

In case the same listener is already observing this instance, calling this method will not add the listener again.

removeListener(listener: BarcodeCaptureListener): void

Added in version 6.13.0

Removes a previously added listener from this barcode capture instance.

In case the listener is not currently observing this instance, calling this method has no effect.

static get recommendedCameraSettings(): CameraSettings

Added in version 6.13.0

Returns the recommended camera settings for use with barcode capture.

get context(): DataCaptureContext | null

Added in version 6.13.0

Implemented from DataCaptureMode. See DataCaptureMode.context.

function barcodeCaptureLoader(options?: BarcodeCaptureLoaderOptions): ModuleLoader

Added in version 6.13.0

Use this function to load the Barcode Capture module when configuring the SDK with Core.configure(). The function must be called and its result must be passed to the option ConfigureOptions.moduleLoaders.