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 >
Dev Center
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

Javascript API Reference - BarcodeScanner Capture Settings

Method Description
getCapabilities() Get the camera capabilities.
getResolution() Get current video resolution.
setResolution() Set current video resolution.
getScanSettings() Get current scan settings.
updateScanSettings() Modify and update scan settings.
getVideoSettings() Get current video settings.
updateVideoSettings() Modify and update video settings.
setColorTemperature() Adjust the video colour temperature.
setExposureCompensation() Adjust the video exposure level.
setFrameRate() Adjust the video frame rate.
setZoom() Adjust the video zoom ratio.
turnOffTorch() Turn off the torch/flashlight.
turnOnTorch() Turn on the torch/flashlight.

getCapabilities

Get the camera capabilities.

This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported.

getCapabilities() returns MediaTrackCapabilities

Return Value

MediaTrackCapabilities

Example

> scanner.getCapabilities()
< {
  "aspectRatio":{"max":3840,"min":0.000462962962962963},
  "colorTemperature": {max: 7000, min: 2850, step: 50},
  "deviceId":"1e...3af7",
  "exposureCompensation": {max: 2.0000040531158447, min: -2.0000040531158447, step: 0.16666699945926666},
  "exposureMode":["continuous","manual"],
  "facingMode":["environment"],
  "focusMode":["continuous","single-shot","manual"],
  "frameRate":{"max":30,"min":0},
  "groupId":"71...a935",
  "height":{"max":2160,"min":1},
  "resizeMode":["none","crop-and-scale"],
  "torch":true,
  "whiteBalanceMode":["continuous","manual"],
  "width":{"max":3840,"min":1},
  "zoom":{max: 606, min: 100, step: 2}
  }

:+1: Tips and Tricks

Check out the following APIs to modify your device capabilities (if supported).

getResolution

Get current video resolution.

getResolution() returns number[]

Return Value

number[]

Sample

let rsl = await scanner.getResolution();
console.log(rsl.width + " x " + rsl.height);

Read barcodes from live camera

setResolution

Set the camera resolution.

setResolution(width, height) returns Promise

Parameters

  • width number number[]
  • height number

Return Value

Promise<ScannerPlayCallbackInfo>

Sample

Read barcodes from live camera

getScanSettings

Get current scan settings of BarcodeScanner and saves it into a struct.

getScanSettings() returns Promise

Return Value

Promise<ScanSettings>

Sample

Read barcodes from live camera

updateScanSettings

Modify and update scan settings.

updateScanSettings(settings) returns Promise

Parameters

settings ScanSettings

Return Value

Promise<void>

Sample

Read barcodes from live camera

getVideoSettings

Get current video settings of BarcodeScanner and saves it into a struct.

getVideoSettings() returns MediaStreamConstraints

Return Value

MediaStreamConstraints

Sample

Read barcodes from live camera

updateVideoSettings

Modify and update video settings.

updateVideoSettings(MediaStreamConstraints) returns Promise

Parameters

MediaStreamConstraints any

Return Value

Promise<ScannerPlayCallbackInfo | void>

Sample

await scanner.updateVideoSettings({ 
    video: { width: { ideal: 1280 }, 
             height: { ideal: 720 }, 
             facingMode: { ideal: 'environment' } 
    }
});

Read barcodes from live camera

setColorTemperature

Adjust the video colour temperature.

This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported. Check if this capability is supported by the camera using getCapabilities.

setColorTemperature(value) returns Promise

Parameters

value number

Return Value

Promise<void>

Sample

Read barcodes from live camera

setExposureCompensation

Adjust the video exposure level.

This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported. Check if this capability is supported by the camera using getCapabilities.

setExposureCompensation(value) returns Promise

Parameters

value number

Return Value

Promise<void>

Sample

Read barcodes from live camera

setFrameRate

Adjust the video frame rate.

This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported. Check if this capability is supported by the camera using getCapabilities.

setFrameRate(value) returns Promise

Parameters

value number

Return Value

Promise<void>

Sample

Read barcodes from live camera

setZoom

Adjust the video zoom ratio.

This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported. Check if this capability is supported by the camera using getCapabilities.

setZoom(value) returns Promise

Parameters

value number

Return Value

Promise<void>

Sample

Read barcodes from live camera

turnOffTorch

Turn off the torch/flashlight.

This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported. Check if this capability is supported by the camera using getCapabilities.

turnOffTorch() returns Promise

Return Value

Promise<void>

Sample

Read barcodes from live camera

turnOnTorch

Turn on the torch/flashlight.

This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported. Check if this capability is supported by the camera using getCapabilities.

turnOnTorch() returns Promise

Return Value

Promise<void>

Sample

Read barcodes from live camera

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest version
    • Version 9.x
      • Version 9.2.12
      • Version 9.0.2
      • Version 9.0.1
      • Version 9.0.0
    • Version 8.x
      • Version 8.8.7
      • Version 8.8.5
      • Version 8.8.3
      • Version 8.8.0
      • Version 8.6.3
      • Version 8.6.0
      • Version 8.4.0
      • Version 8.2.5
      • Version 8.2.3
      • Version 8.2.1
      • Version 8.2.0
      • Version 8.1.3
      • Version 8.1.2
      • Version 8.1.0
      • Version 8.0.0
    • Version 7.x
      • Version 7.6.0
      • Version 7.5.0
    Change +
    © 2003–2023 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support