Options
All
  • Public
  • Public/Protected
  • All
Menu

Scandit Barcode Scanner SDK for the Web

Index

Functions

configure

  • configure(licenseKey: string, parameters?: { engineLocation?: string; highQualityBlurryRecognition?: boolean; preloadBlurryRecognition?: boolean; preloadEngine?: boolean }): Promise<void>
  • Initialize and configure the Scandit Barcode Scanner SDK library. This function must be called (once) before instantiating the main library components (BarcodePicker and Scanner objects) and returns a promise. In case this is called again after a successful call, parameters from subsequent calls are ignored and the same promise returned from the successful call will be returned.

    Depending on parameters and browser features, any of the following errors could be the rejected result of the returned promise:

    • NoLicenseKeyError
    • UnsupportedBrowserError

    The external external Scandit Engine library and data needed for blurry recognition are preloaded asynchronously eagerly by default after library configuration to ensure the best performance. If needed this behaviour can be changed via the preloadEngine and preloadBlurryRecognition options.

    For optimal performance, it is recommended to call this function as soon as possible to ensure needed components are preloaded and initialized ahead of time.

    Camera access requests are done lazily only when needed by a BarcodePicker (or Scanner) object. You can also eagerly ask only for camera access permissions by calling the CameraAccess.getCameras function.

    Ideally, to make the scanning process faster, it is recommended depending on the use case to create in advance a (hidden and paused) BarcodePicker or Scanner object, to later show and unpause it when needed. Depending on the options this can also be used to correctly ask for camera access permissions whenever preferred.

    Parameters

    • licenseKey: string

      The Scandit license key to be used by the library.

    • parameters: { engineLocation?: string; highQualityBlurryRecognition?: boolean; preloadBlurryRecognition?: boolean; preloadEngine?: boolean } = ...
      • Optional engineLocation?: string
        Default = "/"
        The location of the folder containing the external scandit-engine-sdk.min.js and scandit-engine-sdk.wasm files (external Scandit Engine library). By default they are retrieved from the root of the web application. Can be a full URL to folder or an absolute folder path.
      • Optional highQualityBlurryRecognition?: boolean
        Default = false
        Whether to generate and use high quality 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 - at a time depending on the preloadBlurryRecognition option - and for the processing of each video frame.

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

      • Optional preloadBlurryRecognition?: boolean
        Default = true
        Whether to preload (load or generate if needed) data needed for blurry recognition as soon as possible via a separate asynchronous WebWorker thread running the Scandit Engine library. Data for all symbologies is generated over time.

        If enabled, any BarcodePicker or Scanner object will be able to start processing video frames much faster, as it won't need to generate blurry recognition data lazily only when needed. If necessary, depending on given ScanSettings options and on readiness of the data, processing is also initially performed without blurry recognition until this data becomes available, at which point the new data will be loaded and used.

        If disabled, BarcodePicker or Scanner objects will load or generate blurry recognition data lazily when needed to process the first frame, depending on given ScanSettings options, and will thus require more time the first time the library is actively used with the given active symbologies. As this needs to be done in the same WebWorker, the processing of the frame will then be blocked until the needed data is loaded or generated.

        Note that in either case the data for blurry recognition will be cached for later successive uses of the library.

        Note that preloading does not trigger a device activation for licensing purposes.

      • Optional preloadEngine?: boolean
        Default = true
        Whether to preload (download if needed, compile/instantiate WebAssembly code and initialize) the external Scandit Engine library, used by BarcodePicker and Scanner objects to perform scan operations.

        If enabled, any BarcodePicker or Scanner object will be ready to start processing video frames much faster, as the needed external Scandit Engine library will already be in a partially or fully initialized state thanks to it being preloaded now.

        If disabled, BarcodePicker and Scanner objects will load the external Scandit Engine library on creation (if it wasn't already loaded before by a previously created object), and will thus require more time to be initialized and ready.

        Note that in either case the loaded external Scandit Engine library will be reused whenever possible for later successive uses of the library.

        Note that preloading does not trigger a device activation for licensing purposes.

    Returns Promise<void>

    A promise resolving when the library has been configured (preloading is done independently asynchronously).

Generated using TypeDoc