ScannerSettings

ScannerSettings


The ScannerSettings object defines all properties of Web Barcode SDK

Syntax

var ScannerSettings = {
	scanner: {
		frameTimeout: 100,
		barcodeTimeout: 1000,
		drawTimeout: 500,
		beep: true,
		beepData: "https://mysite.com/beep.mp3",
	},
	viewport: {
		id: 'datasymbol-barcode-viewport',
		width: 640,
		height: 480,
	},
	camera: {
		id: null,
		label: null,
		facingMode: 'user',//environment
		resx: 640,
		resy: 480,
	},
	barcode: {
		barcodeTypes: ['Code128', 'Code39', 'EAN13', 'UPCA', 'DataMatrix', 'QRCode'],
		totalBarcodes: 1,
		//... all properies from setProperty WebAssembly method.
	},
};

ScannerSettings.scanner
  • frameTimeout - pause (ms, default 100) between decoding of frames
  • barcodeTimeout - pause (ms, default 1000) after successfully decoded barcode, allows to avoid repeated decoding of the same barcode
  • drawTimeout - pause (ms, default 500) during which the barcode is rendered in preview
  • beep - boolean (default true) defines play or not beep sound after successfully decoded barcode
  • beepData - URL for beep sound, if undefined SDK will play default one

ScannerSettings.viewport
  • id - within the HTML element with given ID, all necessary elements of the barcode reader are created
  • width - the width of the HTML element video that will make a preview from the camera, if the null or undefined preview occupies the entire parental element. If the "width" is specified, you may not set the "height" parameter, in this case, the height will be proportional to the size of the frame.
  • height - same as width

ScannerSettings.camera
  • id - specifies the video device ID that you want to use (see getVideoDevices method), if null or undefined, the device will be used by default
  • label - name of video device, really you do not need to pass it
  • facingMode - this parameter can be used for mobile devices instead of the video device ID. Please, use string 'user' or 'environment'.
  • resx - required X resolution of video frame, if the camera does not support such a resolution, the nearest possible will be used. Do not use (without the need) large frame resolution, because this could significantly encrease the frame processing time.
  • resy - same as resx

ScannerSettings.barcode