Web Demos

BARCODE READER SDK DEMO

Explore the flexibe barcode reading settings to optimize for your specific usage scenario.

WEB TWAIN SDK DEMO

Try the most popular web scanner features: scan images, import local images and PDF files, edit, save to local, upload to database, and etc.

BARCODE READER JAVASCRIPT DEMO

Transform any camera-equipped devices into real-time, browser-based barcode and QR code scanners.

MRZ SCANNER WEB DEMO

Detects the machine-readable zone of a passport, scans the text, and parses into human-readable data.

APP STORE DEMOS

BARCODE READER SDK FOR IOS

BARCODE READER SDK FOR ANDROID

VIEW MORE DEMOS >
Resource Base
Table of contents

Auxiliary

API Name Description
on() Attaches an event handler function for a built-in event.
off() Removes an event handler.
offAll() Removes all event handlers from the specified event. If no event is specified, remove all event handlers.
dispose() Releases all resources used by the CameraEnhancer instance.
isDisposed A readonly boolean value indicating whether the CameraEnhancer instance has been disposed.
getVersion() Returns the version of the library.
detectEnvironment() Returns a report on the current running environments.

Type definition used on this page:

type EventName = "cameraChange" | "cameraOpen" | "cameraClose" | "resolutionChange" | "played" | "singleFrameAcquired" | "frameAddedToBuffer";

on

Attaches an event handler function for a built-in event.

on(eventName: EventName, listener: Function): void;

Parameters

eventName : specifies the event.

listener : specifies the handler function.

Return value

None.

Code Snippet

let enhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance();
enhancer.on("cameraChange", playCallBackInfo => {
    console.log(playCallBackInfo.deviceId);
});
enhancer.on("cameraOpen", playCallBackInfo => {
    console.log(playCallBackInfo.deviceId);
});
enhancer.on("cameraClose", playCallBackInfo => {
    console.log(playCallBackInfo.deviceId);
});
enhancer.on("resolutionChange", playCallBackInfo => {
    console.log("width:" + playCallBackInfo.width);
    console.log("height:" + playCallBackInfo.height);
});
enhancer.on("played", playCallBackInfo => {
    console.log(playCallBackInfo.deviceId);
});
enhancer.on("singleFrameAcquired", dceFrame => {
    document.body.appendChild(dceFrame.toCanvas());
});
enhancer.on("frameAddedToBuffer", () => {
    let dceFrame = enhancer.getFrameFromBuffer();
    document.body.appendChild(dceFrame.toCanvas());
});

off

Removes an event handler.

off(eventName: EventName, listener: Function): void;

Parameters

eventName : specifies the event.

listener : specifies the handler function.

Return value

None.

Code Snippet

let enhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance();
let cameraChanged = playCallBackInfo => {
    console.log(playCallBackInfo.deviceId);
    enhancer.off("cameraChange", cameraChanged);
}
enhancer.on("cameraChange", cameraChanged);

offAll

Removes all event handlers from the specified event. If no event is specified, remove all event handlers.

offAll(eventName?: EventName): void;

Parameters

eventName : specifies the event.

Return value

None.

Code Snippet

enhancer.offAll("cameraChange");

dispose

Releases all resources used by the CameraEnhancer instance. After that, the instance will be left with only the property isDisposed (the value is true).

The HTML elements used by the instance’s UI element are only removed when removeUIElement is set to true. Otherwise, they are only hidden.

dispose(removeUIElement?: boolean): void;

Parameters

removeUIElement: whether to hide or remove the HTML elements in the instance’s UI element.

Return value

None.

Code Snippet

let enhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance();
// Use the object to perform some tasks
enhancer.dispose();

isDisposed

A readonly boolean value indicating whether the CameraEnhancer instance has been disposed.

readonly isDisposed: boolean; 

Code Snippet

let enhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance();
//...
let flag = enhancer.isDisposed;

getVersion

Returns the version of the library.

static getVersion(): string;

Parameters

None.

Return value

The version string of the library.

Code Snippet

Dynamsoft.DCE.CameraEnhancer.getVersion();

detectEnvironment

Returns a report (in JSON) on the current running environments.

static detectEnvironment(): Promise<any>;

Parameters

None.

Return value

A JSON object about the running environment. For example

{
    "wasm": true,
    "worker": true,
    "getUserMedia": true,
    "camera": true,
    "browser": "Chrome",
    "version": 90,
    "OS": "Windows"
}

Code Snippet

await Dynamsoft.DCE.CameraEnhancer.detectEnvironment();

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 2.3.2
  • Version 2.3.1
  • Version 2.1.0
  • Version 2.0.0
  • Version 1.0.3
  • Version 1.0.1
  • Version 1.0.0
Change +
© 2003–2022 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support