Resource Base
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. Chrome only. Camera must be open before use.

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. Chrome only. Camera must be open before use. 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. Chrome only. Camera must be open before use. 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. Chrome only. Camera must be open before use. 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. Chrome only. Camera must be open before use. 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. Chrome only. Camera must be open before use. 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. Chrome only. Camera must be open before use. 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 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.6.0
    • Version 7.5.0
    Change +
    © 2003–2021 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support