dynamsoft-javascript-barcode
Advanced tools
Comparing version 7.3.0-v2 to 7.3.0-v3
@@ -7,6 +7,8 @@ /** | ||
* @author Dynamsoft | ||
* @version 7.3.0.2 (js 20200214) | ||
* @version 7.3.0.3 (js 20200331) | ||
* @fileoverview Dynamsoft JavaScript Library for Barcode Reader | ||
* More info on DBR JS: https://www.dynamsoft.com/Products/barcode-recognition-javascript.aspx | ||
*/ | ||
// Generated by dts-bundle-generator v4.0.0 | ||
/// <reference types="node" /> | ||
@@ -62,3 +64,2 @@ | ||
BF_GS1_DATABAR = 260096, | ||
BF_POSTALCODE = 32505856, | ||
BF_CODE_39 = 1, | ||
@@ -83,7 +84,2 @@ BF_CODE_128 = 2, | ||
BF_PATCHCODE = 262144, | ||
BF_USPSINTELLIGENTMAIL = 1048576, | ||
BF_POSTNET = 2097152, | ||
BF_PLANET = 4194304, | ||
BF_AUSTRALIANPOST = 8388608, | ||
BF_UKROYALMAIL = 16777216, | ||
BF_PDF417 = 33554432, | ||
@@ -239,6 +235,10 @@ BF_QR_CODE = 67108864, | ||
protected static _version: string; | ||
static readonly version: string; | ||
static get version(): string; | ||
protected static _productKeys: string; | ||
static productKeys: string; | ||
static get productKeys(): string; | ||
/** | ||
* Get or set the Dynamsoft Barcode Reader SDK product keys. | ||
*/ | ||
static set productKeys(keys: string); | ||
/** | ||
* modify from https://gist.github.com/2107/5529665 | ||
@@ -261,2 +261,3 @@ * @ignore | ||
protected static _engineResourcePath?: string; | ||
static get engineResourcePath(): string; | ||
/** | ||
@@ -270,3 +271,3 @@ * The SDK will try to automatically explore the engine location. | ||
*/ | ||
static engineResourcePath: string; | ||
static set engineResourcePath(value: string); | ||
protected static _licenseServer?: string; | ||
@@ -276,6 +277,7 @@ /** | ||
*/ | ||
static get licenseServer(): string; | ||
/** | ||
* @ignore | ||
*/ | ||
static licenseServer: string; | ||
* @ignore | ||
*/ | ||
static set licenseServer(value: string); | ||
private static _deviceFriendlyName; | ||
@@ -285,6 +287,7 @@ /** | ||
*/ | ||
static get deviceFriendlyName(): string; | ||
/** | ||
* @ignore | ||
*/ | ||
static deviceFriendlyName: string; | ||
* @ignore | ||
*/ | ||
static set deviceFriendlyName(value: string); | ||
/** | ||
@@ -372,2 +375,3 @@ * @ignore | ||
* Determine if the decoding module has been loaded successfully. | ||
* @category Initialize and Destroy | ||
*/ | ||
@@ -381,2 +385,3 @@ static isLoaded(): boolean; | ||
* Manually load and compile the decoding module. Used for preloading to avoid taking too long for lazy loading. | ||
* @category Initialize and Destroy | ||
*/ | ||
@@ -390,2 +395,3 @@ static loadWasm(): Promise<void>; | ||
* ``` | ||
* @category Initialize and Destroy | ||
*/ | ||
@@ -402,2 +408,3 @@ static createInstance(): Promise<BarcodeReader>; | ||
* @param source | ||
* @category Decode | ||
*/ | ||
@@ -415,2 +422,3 @@ decode(source: Blob | Buffer | ArrayBuffer | Uint8Array | Uint8ClampedArray | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | string): Promise<TextResult[]>; | ||
* @param base64 | ||
* @category Decode | ||
*/ | ||
@@ -427,2 +435,3 @@ decodeBase64String(base64: string): Promise<TextResult[]>; | ||
* @param url | ||
* @category Decode | ||
*/ | ||
@@ -446,2 +455,12 @@ decodeUrl(url: string): Promise<TextResult[]>; | ||
_decodeBuffer_Blob(buffer: Blob, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise<any>; | ||
/** | ||
* Decode barcodes from raw buffer. | ||
* @param buffer | ||
* @param width | ||
* @param height | ||
* @param stride | ||
* @param format | ||
* @param config | ||
* @category Decode | ||
*/ | ||
decodeBuffer(buffer: Uint8Array | Uint8ClampedArray | ArrayBuffer | Blob | Buffer, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise<any>; | ||
@@ -460,2 +479,3 @@ /** | ||
* @see [RuntimeSettings](https://www.dynamsoft.com/help/Barcode-Reader/struct_dynamsoft_1_1_barcode_1_1_public_runtime_settings.html) | ||
* @category Runtime Settings | ||
*/ | ||
@@ -474,2 +494,3 @@ getRuntimeSettings(): Promise<RuntimeSettings>; | ||
* @see [RuntimeSettings](https://www.dynamsoft.com/help/Barcode-Reader/struct_dynamsoft_1_1_barcode_1_1_public_runtime_settings.html) | ||
* @category Runtime Settings | ||
*/ | ||
@@ -482,2 +503,3 @@ updateRuntimeSettings(settings: RuntimeSettings | string): Promise<void>; | ||
* ``` | ||
* @category Runtime Settings | ||
*/ | ||
@@ -492,2 +514,3 @@ resetRuntimeSettings(): Promise<void>; | ||
* @ignore | ||
* @category Runtime Settings | ||
*/ | ||
@@ -502,2 +525,3 @@ outputSettingsToString(): Promise<string>; | ||
* @ignore | ||
* @category Runtime Settings | ||
*/ | ||
@@ -552,2 +576,3 @@ initRuntimeSettingsWithString(settings: any): Promise<void>; | ||
* @param argumentValue | ||
* @category Runtime Settings | ||
*/ | ||
@@ -563,2 +588,3 @@ setModeArgument(modeName: string, index: number, argumentName: string, argumentValue: string): Promise<void>; | ||
* @param argumentName | ||
* @category Runtime Settings | ||
*/ | ||
@@ -582,2 +608,3 @@ getModeArgument(modeName: string, index: number, argumentName: string): Promise<string>; | ||
* Equivalent to the previous method `deleteInstance()`. | ||
* @category Initialize and Destroy | ||
*/ | ||
@@ -600,3 +627,3 @@ destroy(): Promise<any>; | ||
} | ||
export interface ScannerConfig { | ||
export interface ScanSettings { | ||
intervalTime?: number; | ||
@@ -641,3 +668,4 @@ duplicateForgetTime?: number; | ||
private static _defaultUIElementURL; | ||
static defaultUIElementURL: string; | ||
static get defaultUIElementURL(): string; | ||
static set defaultUIElementURL(value: string); | ||
/** | ||
@@ -652,2 +680,3 @@ * @ignore | ||
* Get the HTML element that contains your scanner object. | ||
* @category UI | ||
*/ | ||
@@ -661,7 +690,8 @@ getUIElement(): HTMLElement; | ||
* let scanner = await Dynamsoft.BarcodeScanner.createInstance(); | ||
* scanner.setUIElement(document.getElementByClass("dbrScanner-video")[0]); | ||
* await scanner.show(); | ||
* scanner.setUIElement(document.getElementByClassName("dbrScanner-video")[0]); | ||
* await scanner.open(); | ||
* </script> | ||
* ``` | ||
* @param element | ||
* @category UI | ||
*/ | ||
@@ -688,11 +718,12 @@ setUIElement(elementOrUrl: HTMLElement | string): Promise<void>; | ||
*/ | ||
get singleFrameMode(): boolean; | ||
/** | ||
* A mode not use video, get a frame from OS camera instead. | ||
* ```js | ||
* let scanner = await Dynamsoft.BarcodeReader.createInstance(); | ||
* scanner.singleFrameMode = true; // use singleFrameMode anyway | ||
* scanner.show(); | ||
* ``` | ||
*/ | ||
singleFrameMode: boolean; | ||
* A mode not use video, get a frame from OS camera instead. | ||
* ```js | ||
* let scanner = await Dynamsoft.BarcodeReader.createInstance(); | ||
* scanner.singleFrameMode = true; // use singleFrameMode anyway | ||
* scanner.show(); | ||
* ``` | ||
*/ | ||
set singleFrameMode(value: boolean); | ||
private _singleFrameModeIpt; | ||
@@ -759,9 +790,10 @@ private _clickIptSingleFrameMode; | ||
*/ | ||
get soundOnSuccessfullRead(): HTMLAudioElement; | ||
/** | ||
* The sound to play when the scanner get successfull read. | ||
* ```js | ||
* scanner.soundOnSuccessfullRead = new Audio("./pi.mp3"); | ||
* ``` | ||
*/ | ||
soundOnSuccessfullRead: HTMLAudioElement; | ||
* The sound to play when the scanner get successfull read. | ||
* ```js | ||
* scanner.soundOnSuccessfullRead = new Audio("./pi.mp3"); | ||
* ``` | ||
*/ | ||
set soundOnSuccessfullRead(value: HTMLAudioElement); | ||
/** | ||
@@ -787,10 +819,29 @@ * Whether to play sound when the scanner get successfull read. | ||
_videoTrack: MediaStreamTrack; | ||
/** | ||
* @category UI | ||
*/ | ||
regionMaskFillStyle: string; | ||
/** | ||
* @category UI | ||
*/ | ||
regionMaskStrokeStyle: string; | ||
/** | ||
* @category UI | ||
*/ | ||
regionMaskLineWidth: number; | ||
/** | ||
* @category UI | ||
*/ | ||
barcodeFillStyle: string; | ||
/** | ||
* @category UI | ||
*/ | ||
barcodeStrokeStyle: string; | ||
/** | ||
* @category UI | ||
*/ | ||
barcodeLineWidth: number; | ||
private _region; | ||
private region; | ||
private set region(value); | ||
private get region(); | ||
/** | ||
@@ -806,2 +857,3 @@ * @ignore | ||
* @param config | ||
* @category Initialize and Destroy | ||
*/ | ||
@@ -837,2 +889,3 @@ static createInstance(config?: any): Promise<BarcodeScanner>; | ||
* @see [RuntimeSettings](https://www.dynamsoft.com/help/Barcode-Reader/struct_dynamsoft_1_1_barcode_1_1_public_runtime_settings.html) | ||
* @category Runtime Settings | ||
*/ | ||
@@ -861,3 +914,3 @@ updateRuntimeSettings(settings: RuntimeSettings | string): Promise<void>; | ||
/** | ||
* scanner.played = rsl=>{ console.log(rsl.width+'x'+rsl.height) }; | ||
* scanner.onplayed = rsl=>{ console.log(rsl.width+'x'+rsl.height) }; | ||
*/ | ||
@@ -870,3 +923,3 @@ onPlayed?: (info: ScannerPlayCallbackInfo) => void; | ||
* scanner.onFrameRead = results => { | ||
* for(let result in results){ | ||
* for(let result of results){ | ||
* console.log(result.barcodeText); | ||
@@ -902,2 +955,3 @@ * } | ||
* ``` | ||
* @category Camera Settings | ||
*/ | ||
@@ -910,2 +964,3 @@ getAllCameras(): Promise<VideoDeviceInfo[]>; | ||
* ``` | ||
* @category Camera Settings | ||
*/ | ||
@@ -922,2 +977,3 @@ getCurrentCamera(): Promise<VideoDeviceInfo | null>; | ||
* @param cameraInfoOrDeviceId | ||
* @category Camera Settings | ||
*/ | ||
@@ -931,2 +987,3 @@ setCurrentCamera(cameraInfoOrDeviceId: any): Promise<ScannerPlayCallbackInfo>; | ||
* ``` | ||
* @category Camera Settings | ||
*/ | ||
@@ -941,2 +998,3 @@ getResolution(): number[]; | ||
* @param height | ||
* @category Camera Settings | ||
*/ | ||
@@ -953,3 +1011,3 @@ setResolution(width: number | number[], height: number): Promise<ScannerPlayCallbackInfo>; | ||
*/ | ||
getScanSettings(): Promise<ScannerConfig>; | ||
getScanSettings(): Promise<ScanSettings>; | ||
/** | ||
@@ -965,5 +1023,6 @@ * Update ScanSettings by specify parameter values. | ||
*/ | ||
updateScanSettings(settings: ScannerConfig): Promise<void>; | ||
updateScanSettings(settings: ScanSettings): Promise<void>; | ||
/** | ||
* Get current video settings of the BarcodeScanner object and saves it into a struct. | ||
* @category Camera Settings | ||
*/ | ||
@@ -977,2 +1036,3 @@ getVideoSettings(): MediaStreamConstraints; | ||
* @param MediaStreamConstraints | ||
* @category Camera Settings | ||
*/ | ||
@@ -982,2 +1042,3 @@ updateVideoSettings(MediaStreamConstraints: any): Promise<ScannerPlayCallbackInfo | void>; | ||
* Check if the scanner is open. | ||
* @category Open and Close | ||
*/ | ||
@@ -991,2 +1052,3 @@ isOpen(): boolean; | ||
* Stop the video, and release the camera. | ||
* @category Play and Pause | ||
*/ | ||
@@ -996,2 +1058,3 @@ stop(): void; | ||
* Pause the video. Will not release the camera. | ||
* @category Play and Pause | ||
*/ | ||
@@ -1006,2 +1069,3 @@ pause(): void; | ||
* ``` | ||
* @category Play and Pause | ||
*/ | ||
@@ -1011,2 +1075,3 @@ play(deviceId?: string, width?: number, height?: number): Promise<ScannerPlayCallbackInfo>; | ||
* Pause the decoding process. | ||
* @category Play and Pause | ||
*/ | ||
@@ -1016,2 +1081,3 @@ pauseScan(): void; | ||
* Resume the decoding process. | ||
* @category Play and Pause | ||
*/ | ||
@@ -1043,2 +1109,3 @@ resumeScan(): void; | ||
* @see [[turnOnTorch]][[turnOffTorch]][[setExposureCompensation]][[setZoom]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1072,2 +1139,3 @@ getCapabilities(): MediaTrackCapabilities; | ||
* @see [[turnOffTorch]][[getCapabilities]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1083,2 +1151,3 @@ turnOnTorch(): Promise<void>; | ||
* @see [[turnOnTorch]][[getCapabilities]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1094,2 +1163,3 @@ turnOffTorch(): Promise<void>; | ||
* @see [[getCapabilities]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1105,2 +1175,3 @@ setColorTemperature(value: number): Promise<void>; | ||
* @see [[getCapabilities]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1116,2 +1187,3 @@ setExposureCompensation(value: number): Promise<void>; | ||
* @see [[getCapabilities]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1127,2 +1199,3 @@ setZoom(value: number): Promise<void>; | ||
* @see [[getCapabilities]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1151,2 +1224,3 @@ setFrameRate(value: number): Promise<void>; | ||
* ``` | ||
* @category Open and Close | ||
*/ | ||
@@ -1156,2 +1230,3 @@ open(): Promise<ScannerPlayCallbackInfo>; | ||
* Stop decoding, release camera, unbind UI. | ||
* @category Open and Close | ||
*/ | ||
@@ -1164,2 +1239,3 @@ close(): void; | ||
* ``` | ||
* @category Open and Close | ||
*/ | ||
@@ -1169,2 +1245,3 @@ show(): Promise<ScannerPlayCallbackInfo>; | ||
* Stop decoding, release camera, unbind UI, and set the Element as `display:none;`. | ||
* @category Open and Close | ||
*/ | ||
@@ -1175,2 +1252,3 @@ hide(): void; | ||
* Equivalent to the previous method `deleteInstance()`. | ||
* @category Initialize and Destroy | ||
*/ | ||
@@ -1399,3 +1477,3 @@ destroy(): Promise<any>; | ||
} | ||
export declare const Dynamsoft: { | ||
declare const Dynamsoft: { | ||
BarcodeReader: typeof BarcodeReader; | ||
@@ -1433,2 +1511,4 @@ BarcodeScanner: typeof BarcodeScanner; | ||
}; | ||
export default Dynamsoft; | ||
export default Dynamsoft; | ||
export {}; |
@@ -7,6 +7,8 @@ /** | ||
* @author Dynamsoft | ||
* @version 7.3.0.2 (js 20200214) | ||
* @version 7.3.0.3 (js 20200331) | ||
* @fileoverview Dynamsoft JavaScript Library for Barcode Reader | ||
* More info on DBR JS: https://www.dynamsoft.com/Products/barcode-recognition-javascript.aspx | ||
*/ | ||
// Generated by dts-bundle-generator v4.0.0 | ||
/// <reference types="node" /> | ||
@@ -62,3 +64,2 @@ | ||
BF_GS1_DATABAR = 260096, | ||
BF_POSTALCODE = 32505856, | ||
BF_CODE_39 = 1, | ||
@@ -83,7 +84,2 @@ BF_CODE_128 = 2, | ||
BF_PATCHCODE = 262144, | ||
BF_USPSINTELLIGENTMAIL = 1048576, | ||
BF_POSTNET = 2097152, | ||
BF_PLANET = 4194304, | ||
BF_AUSTRALIANPOST = 8388608, | ||
BF_UKROYALMAIL = 16777216, | ||
BF_PDF417 = 33554432, | ||
@@ -239,6 +235,10 @@ BF_QR_CODE = 67108864, | ||
protected static _version: string; | ||
static readonly version: string; | ||
static get version(): string; | ||
protected static _productKeys: string; | ||
static productKeys: string; | ||
static get productKeys(): string; | ||
/** | ||
* Get or set the Dynamsoft Barcode Reader SDK product keys. | ||
*/ | ||
static set productKeys(keys: string); | ||
/** | ||
* modify from https://gist.github.com/2107/5529665 | ||
@@ -261,2 +261,3 @@ * @ignore | ||
protected static _engineResourcePath?: string; | ||
static get engineResourcePath(): string; | ||
/** | ||
@@ -270,3 +271,3 @@ * The SDK will try to automatically explore the engine location. | ||
*/ | ||
static engineResourcePath: string; | ||
static set engineResourcePath(value: string); | ||
protected static _licenseServer?: string; | ||
@@ -276,6 +277,7 @@ /** | ||
*/ | ||
static get licenseServer(): string; | ||
/** | ||
* @ignore | ||
*/ | ||
static licenseServer: string; | ||
* @ignore | ||
*/ | ||
static set licenseServer(value: string); | ||
private static _deviceFriendlyName; | ||
@@ -285,6 +287,7 @@ /** | ||
*/ | ||
static get deviceFriendlyName(): string; | ||
/** | ||
* @ignore | ||
*/ | ||
static deviceFriendlyName: string; | ||
* @ignore | ||
*/ | ||
static set deviceFriendlyName(value: string); | ||
/** | ||
@@ -372,2 +375,3 @@ * @ignore | ||
* Determine if the decoding module has been loaded successfully. | ||
* @category Initialize and Destroy | ||
*/ | ||
@@ -381,2 +385,3 @@ static isLoaded(): boolean; | ||
* Manually load and compile the decoding module. Used for preloading to avoid taking too long for lazy loading. | ||
* @category Initialize and Destroy | ||
*/ | ||
@@ -390,2 +395,3 @@ static loadWasm(): Promise<void>; | ||
* ``` | ||
* @category Initialize and Destroy | ||
*/ | ||
@@ -402,2 +408,3 @@ static createInstance(): Promise<BarcodeReader>; | ||
* @param source | ||
* @category Decode | ||
*/ | ||
@@ -415,2 +422,3 @@ decode(source: Blob | Buffer | ArrayBuffer | Uint8Array | Uint8ClampedArray | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | string): Promise<TextResult[]>; | ||
* @param base64 | ||
* @category Decode | ||
*/ | ||
@@ -427,2 +435,3 @@ decodeBase64String(base64: string): Promise<TextResult[]>; | ||
* @param url | ||
* @category Decode | ||
*/ | ||
@@ -446,2 +455,12 @@ decodeUrl(url: string): Promise<TextResult[]>; | ||
_decodeBuffer_Blob(buffer: Blob, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise<any>; | ||
/** | ||
* Decode barcodes from raw buffer. | ||
* @param buffer | ||
* @param width | ||
* @param height | ||
* @param stride | ||
* @param format | ||
* @param config | ||
* @category Decode | ||
*/ | ||
decodeBuffer(buffer: Uint8Array | Uint8ClampedArray | ArrayBuffer | Blob | Buffer, width: number, height: number, stride: number, format: EnumImagePixelFormat, config?: any): Promise<any>; | ||
@@ -460,2 +479,3 @@ /** | ||
* @see [RuntimeSettings](https://www.dynamsoft.com/help/Barcode-Reader/struct_dynamsoft_1_1_barcode_1_1_public_runtime_settings.html) | ||
* @category Runtime Settings | ||
*/ | ||
@@ -474,2 +494,3 @@ getRuntimeSettings(): Promise<RuntimeSettings>; | ||
* @see [RuntimeSettings](https://www.dynamsoft.com/help/Barcode-Reader/struct_dynamsoft_1_1_barcode_1_1_public_runtime_settings.html) | ||
* @category Runtime Settings | ||
*/ | ||
@@ -482,2 +503,3 @@ updateRuntimeSettings(settings: RuntimeSettings | string): Promise<void>; | ||
* ``` | ||
* @category Runtime Settings | ||
*/ | ||
@@ -492,2 +514,3 @@ resetRuntimeSettings(): Promise<void>; | ||
* @ignore | ||
* @category Runtime Settings | ||
*/ | ||
@@ -502,2 +525,3 @@ outputSettingsToString(): Promise<string>; | ||
* @ignore | ||
* @category Runtime Settings | ||
*/ | ||
@@ -552,2 +576,3 @@ initRuntimeSettingsWithString(settings: any): Promise<void>; | ||
* @param argumentValue | ||
* @category Runtime Settings | ||
*/ | ||
@@ -563,2 +588,3 @@ setModeArgument(modeName: string, index: number, argumentName: string, argumentValue: string): Promise<void>; | ||
* @param argumentName | ||
* @category Runtime Settings | ||
*/ | ||
@@ -582,2 +608,3 @@ getModeArgument(modeName: string, index: number, argumentName: string): Promise<string>; | ||
* Equivalent to the previous method `deleteInstance()`. | ||
* @category Initialize and Destroy | ||
*/ | ||
@@ -600,3 +627,3 @@ destroy(): Promise<any>; | ||
} | ||
interface ScannerConfig { | ||
interface ScanSettings { | ||
intervalTime?: number; | ||
@@ -641,3 +668,4 @@ duplicateForgetTime?: number; | ||
private static _defaultUIElementURL; | ||
static defaultUIElementURL: string; | ||
static get defaultUIElementURL(): string; | ||
static set defaultUIElementURL(value: string); | ||
/** | ||
@@ -652,2 +680,3 @@ * @ignore | ||
* Get the HTML element that contains your scanner object. | ||
* @category UI | ||
*/ | ||
@@ -661,7 +690,8 @@ getUIElement(): HTMLElement; | ||
* let scanner = await Dynamsoft.BarcodeScanner.createInstance(); | ||
* scanner.setUIElement(document.getElementByClass("dbrScanner-video")[0]); | ||
* await scanner.show(); | ||
* scanner.setUIElement(document.getElementByClassName("dbrScanner-video")[0]); | ||
* await scanner.open(); | ||
* </script> | ||
* ``` | ||
* @param element | ||
* @category UI | ||
*/ | ||
@@ -688,11 +718,12 @@ setUIElement(elementOrUrl: HTMLElement | string): Promise<void>; | ||
*/ | ||
get singleFrameMode(): boolean; | ||
/** | ||
* A mode not use video, get a frame from OS camera instead. | ||
* ```js | ||
* let scanner = await Dynamsoft.BarcodeReader.createInstance(); | ||
* scanner.singleFrameMode = true; // use singleFrameMode anyway | ||
* scanner.show(); | ||
* ``` | ||
*/ | ||
singleFrameMode: boolean; | ||
* A mode not use video, get a frame from OS camera instead. | ||
* ```js | ||
* let scanner = await Dynamsoft.BarcodeReader.createInstance(); | ||
* scanner.singleFrameMode = true; // use singleFrameMode anyway | ||
* scanner.show(); | ||
* ``` | ||
*/ | ||
set singleFrameMode(value: boolean); | ||
private _singleFrameModeIpt; | ||
@@ -759,9 +790,10 @@ private _clickIptSingleFrameMode; | ||
*/ | ||
get soundOnSuccessfullRead(): HTMLAudioElement; | ||
/** | ||
* The sound to play when the scanner get successfull read. | ||
* ```js | ||
* scanner.soundOnSuccessfullRead = new Audio("./pi.mp3"); | ||
* ``` | ||
*/ | ||
soundOnSuccessfullRead: HTMLAudioElement; | ||
* The sound to play when the scanner get successfull read. | ||
* ```js | ||
* scanner.soundOnSuccessfullRead = new Audio("./pi.mp3"); | ||
* ``` | ||
*/ | ||
set soundOnSuccessfullRead(value: HTMLAudioElement); | ||
/** | ||
@@ -787,10 +819,29 @@ * Whether to play sound when the scanner get successfull read. | ||
_videoTrack: MediaStreamTrack; | ||
/** | ||
* @category UI | ||
*/ | ||
regionMaskFillStyle: string; | ||
/** | ||
* @category UI | ||
*/ | ||
regionMaskStrokeStyle: string; | ||
/** | ||
* @category UI | ||
*/ | ||
regionMaskLineWidth: number; | ||
/** | ||
* @category UI | ||
*/ | ||
barcodeFillStyle: string; | ||
/** | ||
* @category UI | ||
*/ | ||
barcodeStrokeStyle: string; | ||
/** | ||
* @category UI | ||
*/ | ||
barcodeLineWidth: number; | ||
private _region; | ||
private region; | ||
private set region(value); | ||
private get region(); | ||
/** | ||
@@ -806,2 +857,3 @@ * @ignore | ||
* @param config | ||
* @category Initialize and Destroy | ||
*/ | ||
@@ -837,2 +889,3 @@ static createInstance(config?: any): Promise<BarcodeScanner>; | ||
* @see [RuntimeSettings](https://www.dynamsoft.com/help/Barcode-Reader/struct_dynamsoft_1_1_barcode_1_1_public_runtime_settings.html) | ||
* @category Runtime Settings | ||
*/ | ||
@@ -861,3 +914,3 @@ updateRuntimeSettings(settings: RuntimeSettings | string): Promise<void>; | ||
/** | ||
* scanner.played = rsl=>{ console.log(rsl.width+'x'+rsl.height) }; | ||
* scanner.onplayed = rsl=>{ console.log(rsl.width+'x'+rsl.height) }; | ||
*/ | ||
@@ -870,3 +923,3 @@ onPlayed?: (info: ScannerPlayCallbackInfo) => void; | ||
* scanner.onFrameRead = results => { | ||
* for(let result in results){ | ||
* for(let result of results){ | ||
* console.log(result.barcodeText); | ||
@@ -902,2 +955,3 @@ * } | ||
* ``` | ||
* @category Camera Settings | ||
*/ | ||
@@ -910,2 +964,3 @@ getAllCameras(): Promise<VideoDeviceInfo[]>; | ||
* ``` | ||
* @category Camera Settings | ||
*/ | ||
@@ -922,2 +977,3 @@ getCurrentCamera(): Promise<VideoDeviceInfo | null>; | ||
* @param cameraInfoOrDeviceId | ||
* @category Camera Settings | ||
*/ | ||
@@ -931,2 +987,3 @@ setCurrentCamera(cameraInfoOrDeviceId: any): Promise<ScannerPlayCallbackInfo>; | ||
* ``` | ||
* @category Camera Settings | ||
*/ | ||
@@ -941,2 +998,3 @@ getResolution(): number[]; | ||
* @param height | ||
* @category Camera Settings | ||
*/ | ||
@@ -953,3 +1011,3 @@ setResolution(width: number | number[], height: number): Promise<ScannerPlayCallbackInfo>; | ||
*/ | ||
getScanSettings(): Promise<ScannerConfig>; | ||
getScanSettings(): Promise<ScanSettings>; | ||
/** | ||
@@ -965,5 +1023,6 @@ * Update ScanSettings by specify parameter values. | ||
*/ | ||
updateScanSettings(settings: ScannerConfig): Promise<void>; | ||
updateScanSettings(settings: ScanSettings): Promise<void>; | ||
/** | ||
* Get current video settings of the BarcodeScanner object and saves it into a struct. | ||
* @category Camera Settings | ||
*/ | ||
@@ -977,2 +1036,3 @@ getVideoSettings(): MediaStreamConstraints; | ||
* @param MediaStreamConstraints | ||
* @category Camera Settings | ||
*/ | ||
@@ -982,2 +1042,3 @@ updateVideoSettings(MediaStreamConstraints: any): Promise<ScannerPlayCallbackInfo | void>; | ||
* Check if the scanner is open. | ||
* @category Open and Close | ||
*/ | ||
@@ -991,2 +1052,3 @@ isOpen(): boolean; | ||
* Stop the video, and release the camera. | ||
* @category Play and Pause | ||
*/ | ||
@@ -996,2 +1058,3 @@ stop(): void; | ||
* Pause the video. Will not release the camera. | ||
* @category Play and Pause | ||
*/ | ||
@@ -1006,2 +1069,3 @@ pause(): void; | ||
* ``` | ||
* @category Play and Pause | ||
*/ | ||
@@ -1011,2 +1075,3 @@ play(deviceId?: string, width?: number, height?: number): Promise<ScannerPlayCallbackInfo>; | ||
* Pause the decoding process. | ||
* @category Play and Pause | ||
*/ | ||
@@ -1016,2 +1081,3 @@ pauseScan(): void; | ||
* Resume the decoding process. | ||
* @category Play and Pause | ||
*/ | ||
@@ -1043,2 +1109,3 @@ resumeScan(): void; | ||
* @see [[turnOnTorch]][[turnOffTorch]][[setExposureCompensation]][[setZoom]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1072,2 +1139,3 @@ getCapabilities(): MediaTrackCapabilities; | ||
* @see [[turnOffTorch]][[getCapabilities]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1083,2 +1151,3 @@ turnOnTorch(): Promise<void>; | ||
* @see [[turnOnTorch]][[getCapabilities]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1094,2 +1163,3 @@ turnOffTorch(): Promise<void>; | ||
* @see [[getCapabilities]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1105,2 +1175,3 @@ setColorTemperature(value: number): Promise<void>; | ||
* @see [[getCapabilities]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1116,2 +1187,3 @@ setExposureCompensation(value: number): Promise<void>; | ||
* @see [[getCapabilities]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1127,2 +1199,3 @@ setZoom(value: number): Promise<void>; | ||
* @see [[getCapabilities]] | ||
* @category Camera Settings | ||
*/ | ||
@@ -1151,2 +1224,3 @@ setFrameRate(value: number): Promise<void>; | ||
* ``` | ||
* @category Open and Close | ||
*/ | ||
@@ -1156,2 +1230,3 @@ open(): Promise<ScannerPlayCallbackInfo>; | ||
* Stop decoding, release camera, unbind UI. | ||
* @category Open and Close | ||
*/ | ||
@@ -1164,2 +1239,3 @@ close(): void; | ||
* ``` | ||
* @category Open and Close | ||
*/ | ||
@@ -1169,2 +1245,3 @@ show(): Promise<ScannerPlayCallbackInfo>; | ||
* Stop decoding, release camera, unbind UI, and set the Element as `display:none;`. | ||
* @category Open and Close | ||
*/ | ||
@@ -1175,2 +1252,3 @@ hide(): void; | ||
* Equivalent to the previous method `deleteInstance()`. | ||
* @category Initialize and Destroy | ||
*/ | ||
@@ -1432,1 +1510,4 @@ destroy(): Promise<any>; | ||
}; | ||
{}; |
{ | ||
"name": "dynamsoft-javascript-barcode", | ||
"version": "7.3.0-v2", | ||
"version": "7.3.0-v3", | ||
"description": "Dynamsoft Barcode Reader JS is a recognition SDK which enables you to embed barcode reading functionality in your web, desktop, and mobile applications. With a few lines of JavaScript code, you can develop a robust application to scan a linear barcode, QR Code, DaraMatrix, PDF417, and Aztec Code.", | ||
@@ -50,17 +50,17 @@ "files": [ | ||
"scripts": { | ||
"build": "webpack --config webpack.config.js", | ||
"build": "./node_modules/.bin/dts-bundle-generator -o dist/dbr.d.ts src/dbr.ts & webpack --config webpack.config.js", | ||
"build:node": "webpack --config webpack.config.node.js", | ||
"build:doc": "typedoc --out \"doc/api reference\" --mode file --excludeExternals --excludeNotExported --excludePrivate --excludeProtected --name \"Dynamsoft BarcodeReader SDK for Javascript\"", | ||
"build:doc": "typedoc", | ||
"test": "node test" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^12.12.14", | ||
"@types/node": "^13.9.8", | ||
"declaration-bundler-webpack-plugin": "^1.0.3", | ||
"fork-ts-checker-webpack-plugin": "^1.5.0", | ||
"dts-bundle-generator": "^4.0.0", | ||
"fork-ts-checker-webpack-plugin": "^4.1.2", | ||
"fs-extra": "^8.1.0", | ||
"localforage": "^1.7.3", | ||
"ts-declaration-webpack-plugin": "^1.2.0", | ||
"ts-loader": "^6.0.4", | ||
"typedoc": "^0.15.0", | ||
"typescript": "^3.6.2", | ||
"ts-loader": "^6.2.2", | ||
"typedoc": "^0.17.3", | ||
"typescript": "^3.8.3", | ||
"uglifyjs-webpack-plugin": "^2.2.0", | ||
@@ -71,3 +71,4 @@ "webpack": "^4.39.3", | ||
}, | ||
"dependencies": {} | ||
"dependencies": { | ||
} | ||
} |
160
README.md
@@ -10,15 +10,34 @@ # Dynamsoft JavaScript Barcode SDK for Web | ||
[Dynamsoft BarcodeReader SDK for Web](https://www.dynamsoft.com/Products/barcode-recognition-javascript.aspx) is a JavaScript API for barcode scanning based on the **WebAssembly** technology. It supports real-time localization and decoding of various barcode types. The library is capable of scanning barcodes from static images as well as directly from live video streams. It also supports reading multiple barcodes at once. | ||
[Dynamsoft BarcodeReader SDK for Web](https://www.dynamsoft.com/Products/barcode-recognition-javascript.aspx) is a JavaScript library for barcode scanning based on the **WebAssembly** technology. It supports real-time localization and decoding of various barcode types. The library is capable of scanning barcodes from static images as well as directly from live video streams. It also supports reading multiple barcodes at once. | ||
> Also see [Dynamsoft JavaScript Barcode SDK for Node](https://github.com/dynamsoft-dbr/node-javascript-barcode). | ||
## Quick Usage | ||
## Install | ||
### Web | ||
yarn | ||
``` | ||
$ yarn add dynamsoft-javascript-barcode | ||
``` | ||
npm | ||
``` | ||
$ npm install dynamsoft-javascript-barcode --save | ||
``` | ||
cdn | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v3/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
<!-- or --> | ||
<script src="https://unpkg.com/dynamsoft-javascript-barcode@7.3.0-v3/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
``` | ||
[Download zip](https://www.dynamsoft.com/Downloads/Dynamic-Barcode-Reader-Download.aspx?edition=js) | ||
## Quick Usage | ||
```html | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v2/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v3/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
<script> | ||
@@ -37,2 +56,8 @@ let scanner = null; | ||
[Vue example](https://github.com/dynamsoft-dbr/javascript-barcode/tree/master/example/web/vue) | ||
[React example](https://github.com/dynamsoft-dbr/javascript-barcode/tree/master/example/web/react) | ||
[Angular example](https://github.com/dynamsoft-dbr/javascript-barcode/tree/master/example/web/angular) | ||
<!-- | ||
@@ -58,2 +83,3 @@ ### Node | ||
## Table of Contents | ||
- [Install](#install) | ||
- [Quick Usage](#quick-usage) | ||
@@ -81,3 +107,3 @@ - [Features](#features) | ||
* Supported Symbologies: | ||
#### Supported Symbologies: | ||
@@ -98,5 +124,5 @@ 1D barcode: **`Code 39`**, **`Code 128`**, **`Code 93`**, **`Codabar`**, **`Interleaved 2 of 5 (ITF)`**, **`EAN-13`**, **`EAN-8`**, **`UPC-A`**, **`UPC-E`**, **`Industrial 2 of 5`** (Code 2 of 5 Industry, Standard 2 of 5, Code 2 of 5), **`Code 39 Extended`**. | ||
* Browser Compatibility: | ||
#### Browser Compatibility: | ||
* Unlike normal server-based applications, this library requires some advanced features which fortunately are supported by all mainstream modern browsers. These advanced features are listed below: | ||
* Unlike typical server-based applications, this library requires some advanced features which fortunately are supported by all mainstream modern browsers. These advanced features are listed below: | ||
* [MediaDevices/getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) | ||
@@ -109,3 +135,3 @@ * Required only for in-browser video streaming. If a browser doesn't have this API the [Single Frame Mode](https://www.dynamsoft.com/help/Barcode-Reader-wasm/classes/barcodescanner.html#singleframemode) is used automatically. If the API exists but doesn't work correctly, [Single Frame Mode](https://www.dynamsoft.com/help/Barcode-Reader-wasm/classes/barcodescanner.html#singleframemode) can be used as an alternative. | ||
> **NOTE**: Apart from the browsers, the operating systems running on the target devices may also impose some limitations of their own that could restrict the use of the library. Therefore, the following table serves as a rough estimation instead of an accurate guideline. Browser compatibility ultimately depends on whether the browser on that particular operating system supports the features listed above. | ||
> **NOTE**: Apart from the browsers, the operating systems running on the target devices may also impose some limitations of their own that could restrict the use of the library. Therefore, the following table serves as a rough estimation instead of an accurate guideline. Browser compatibility ultimately depends on whether the browser on that particular operating system supports the features listed above. | ||
@@ -119,3 +145,3 @@ | Browser Name | Version | | ||
<sup>1</sup> On iOS, camera video streaming only works in Safari. | ||
<sup>1</sup> Video streaming is not supported in Chrome/Firefox on iOS. | ||
@@ -128,5 +154,5 @@ <sup>2</sup> On Edge, due to strict Same-origin policy, you must host the library in the same domain as your web page. | ||
* Compact and Full Editions | ||
#### Compact and Full Editions | ||
As more and more features are being added to the library, the supporting `wasm` file is getting bigger and bigger. For flexibility, we provide two editions. The compact edition has less features but downloads and compiles faster, on the other hand, the full edition has all features built-in. | ||
As more features are being added to the library, the supporting `wasm` file is getting larger. For flexibility, we provide two editions. The compact edition has fewer features but downloads and compiles faster; on the other hand, the full edition has all features built-in. | ||
@@ -136,25 +162,25 @@ | Features | Compact edition | Full edition | | ||
| `wasm` size<sup>1</sup>\(gzip\) | 810KB | 1.1 MB | | ||
| 1D | √ | √ | | ||
| QR | √ | √ | | ||
| Mirco QR | **X** | √ | | ||
| PDF417 | √ | √ | | ||
| Mirco PDF417 | **X** | √ | | ||
| DataMatrix | √ | √ | | ||
| Aztec | **X** | √ | | ||
| MaxiCode | **X** | √ | | ||
| Patch Code | **X** | √ | | ||
| GS1 Composite Code | **X** | √ | | ||
| GS1 DataBar | **X** | √ | | ||
| Postal Code | **X** | √ | | ||
| DPM | **X** | √ | | ||
| getRuntimeSettings | √ | √ | | ||
| updateRuntimeSettings | √ | √ | | ||
| getIntermediateResults | **X** | √ | | ||
| initRuntimeSettingsWithString | **X** | √ | | ||
| outputSettingsToString | **X** | √ | | ||
| **recommended scenario<sup>2</sup>** | To C | To B | | ||
| 1D | ✓ | ✓ | | ||
| QR | ✓ | ✓ | | ||
| Mirco QR | - | ✓ | | ||
| PDF417 | ✓ | ✓ | | ||
| Mirco PDF417 | - | ✓ | | ||
| DataMatrix | ✓ | ✓ | | ||
| Aztec | - | ✓ | | ||
| MaxiCode | - | ✓ | | ||
| Patch Code | - | ✓ | | ||
| GS1 Composite Code | - | ✓ | | ||
| GS1 DataBar | - | ✓ | | ||
| Postal Code | - | ✓ | | ||
| DPM | - | ✓ | | ||
| getRuntimeSettings | ✓ | ✓ | | ||
| updateRuntimeSettings | ✓ | ✓ | | ||
| getIntermediateResults | - | ✓ | | ||
| initRuntimeSettingsWithString | - | ✓ | | ||
| outputSettingsToString | - | ✓ | | ||
| **recommended scenario<sup>2</sup>** | Customer Facing Application | Enterprise Solution | | ||
<sup>1</sup> The `wasm` file size is based on version 7.2.2. In later versions, the size may differ. | ||
<sup>2</sup> The compact edition downloads and compiles faster which makes it more suitable for the scenario where a customer only needs to scan a barcode once. On the contrary, in scenarios where an employee needs to continuously scan lots of barcodes or where specific uncommon barcodes or advanced features are required, use the full edition by simply setting the following before you call `loadWasm` or `CreateInstance`. | ||
<sup>2</sup> The compact edition downloads and compiles faster, which makes it more suitable for the scenario where a customer only needs to scan a barcode once. In comparison, scenarios where an employee needs to scan lots of barcodes continuously or where uncommon barcodes or advanced features are required, use the full edition by simply setting the following before you call `loadWasm` or `CreateInstance`. | ||
@@ -185,3 +211,3 @@ `Dynamsoft.BarcodeReader._bUseFullFeature = true;` | ||
* The sample is missing one piece of information to work correctly which is the field `PRODUCT-KEYS`, you can acquire a trial key [here](https://www.dynamsoft.com/CustomerPortal/Portal/TrialLicense.aspx) to replace it. | ||
* You will need to replace <code>PRODUCT-KEYS</code> with a trial key for the sample code to work correctly. You can acquire a trial key [here](https://www.dynamsoft.com/CustomerPortal/Portal/TrialLicense.aspx). | ||
* If you don't have a ready-to-use web server and you happen to have a package manager like `npm` or `yarn`, you can set up a simple http server in minutes. Check out http-server on [npm](https://www.npmjs.com/package/http-server) or [yarn](https://yarnpkg.com/en/package/http-server). | ||
@@ -194,3 +220,3 @@ | ||
<!-- Please visit https://www.dynamsoft.com/CustomerPortal/Portal/TrialLicense.aspx to get a trial license. --> | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v2/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v3/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
<script> | ||
@@ -216,5 +242,5 @@ let scanner = null; | ||
##### **General Issue one** | ||
##### **Possible Scenario 1** | ||
If you open the HTML file as `file:///` or `http://`, the following error may appear in the browser console | ||
If you open the HTML file as `file:///` or `http://`, the following error may appear in the browser console: | ||
@@ -238,7 +264,7 @@ > [Deprecation] getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details. | ||
##### **General Issue Two** | ||
##### **Possible Scenario 2** | ||
For testing purposes, a self-signed certificate can be used when configuring HTTPS. When accessing the site, the browser might say "`the site is not secure`". In this case, go to the certificate settings and trust this certificate. | ||
> In a production environment, you will need a valid HTTPS certificate that does not have this issue. If you don't have one yet, you can get a free one from [Let’s Encrypt](https://letsencrypt.org/). Of course, you are advised to apply for a paid certificate from companies such as Verisign, GeoTrust, etc. | ||
> In a production environment, you will need a valid HTTPS certificate that does not have this issue. If you don't have one yet, you can get a free one from [Let’s Encrypt](https://letsencrypt.org/). We recommend obtaining a paid certificate from companies such as Verisign, GeoTrust, etc. | ||
@@ -256,3 +282,3 @@ ### Step Three: Time to scan! | ||
```javascript | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v2/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v3/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
``` | ||
@@ -263,6 +289,6 @@ | ||
```javascript | ||
<script src="https://unpkg.com/dynamsoft-javascript-barcode@7.3.0-v2/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
<script src="https://unpkg.com/dynamsoft-javascript-barcode@7.3.0-v3/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
``` | ||
> **NOTE**: Since we do change the library a bit in each release, to make sure your application doesn't get interrupted by automatic updates, use a specific version in your production environment as shown above. Using a general major version like `@7` is not recommended. | ||
> **NOTE**: : Since we do change the library a bit in each release, to make sure your application doesn't get interrupted by automatic updates, use a specific version in your production environment, as shown above. Using a general major version like `@7` is not recommended. | ||
@@ -295,3 +321,3 @@ * The following script initializes and uses the library | ||
The library is based on the `WebAssembly` standard, therefore, **on first use**, it needs some time to download and compile the `wasm` files. After the first use, the browser may cache the file so that the next time no 'downloading' is required. | ||
The library is based on the `WebAssembly` standard; therefore, **on first use**, it needs some time to download and compile the `wasm` files. After the first use, the browser may cache the file so that the next time no 'downloading' is required. | ||
@@ -327,3 +353,3 @@ `Dynamsoft.BarcodeReader.loadWasm` is the API to start the initialization. | ||
Download the necessary resources. Usually we deploy the resources on CDN and set a long cache duration. If your web server is faster, you should put the resources on your own server instead of the CDN. | ||
Download the necessary resources. Usually, we deploy the resources on CDN and set a long cache duration. If your web server is faster, you should put the resources on your own server instead of the CDN. | ||
@@ -336,3 +362,3 @@ #### 2. Compile | ||
The library needs to initialize every time the page loads. The initialization basically means creating an `BarcodeReader`or `BarcodeScanner` instance with specified settings. | ||
The library needs to initialize every time the page loads. The initialization means creating an `BarcodeReader`or `BarcodeScanner` instance with specified settings. | ||
@@ -342,3 +368,3 @@ | ||
When creating an instance of the `BarcodeScanner` object, there are a number of configuration options. The following code shows some of the most useful ones: | ||
When creating an instance of the `BarcodeScanner` object, there are several configuration options. The following code shows some of the most useful ones: | ||
@@ -352,3 +378,3 @@ ```js | ||
// make changes to the template, below it just specifies which symbologies are enabled | ||
// make changes to the template. The code snippet below demonstrates how to specify which symbologies are enabled | ||
let runtimeSettings = await scanner.getRuntimeSettings(); | ||
@@ -362,3 +388,3 @@ runtimeSettings.barcodeFormatIds = Dynamsoft.EnumBarcodeFormat.BF_ONED | Dynamsoft.EnumBarcodeFormat.BF_QR_CODE; | ||
scanSettings.duplicateForgetTime = 20000; | ||
// set a scan interval so that the library may release the CPU from time to time | ||
// set a scan interval so the library may release the CPU from time to time | ||
scanSettings.intervalTime = 300; | ||
@@ -370,5 +396,5 @@ await scanner.updateScanSettings(scanSettings); | ||
As you can see in the code, there are basically three categories of configurations. | ||
As you can see in the code, there are three categories of configurations. | ||
* `get/updateVideoSettings`: Configures the data source, I.E., the video stream. These settings include which camera to use , the resolution, etc.. Check out more information [here](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Syntax). | ||
* `get/updateVideoSettings`: Configures the data source, i.e., the video stream. These settings include which camera to use, the resolution, etc.. Learn more [here](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Syntax). | ||
* `get/updateRuntimeSettings`: Configures the decode engine. Find a full list of these settings and their corresponding descriptions [here](https://www.dynamsoft.com/help/Barcode-Reader/struct_dynamsoft_1_1_barcode_1_1_public_runtime_settings.html). | ||
@@ -405,3 +431,3 @@ [Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/f24h8c1m/) | ||
1. Modify the file `dist/dbr.scanner.html` directly (only possible when you deploy these files yourself instead of using the CDN). | ||
2. Copy the file `dist/dbr.scanner.html`, modify it and specify the new file as the default UI by its URL `Dynamsoft.BarcodeScanner.defaultUIElementURL = url`. Note that you must set `defaultUIElementURL` before you call the API `createInstance`. | ||
2. Copy the file `dist/dbr.scanner.html`, modify it and specify the new file as the default UI by its URL `Dynamsoft.BarcodeScanner.defaultUIElementURL = url`. Note that you must set `defaultUIElementURL` before you call `createInstance`. | ||
3. Build the UI into your own web page and call `scanner.setUIElement(HTMLElement)` to specify that element. | ||
@@ -419,3 +445,3 @@ | ||
<!-- Please visit https://www.dynamsoft.com/CustomerPortal/Portal/TrialLicense.aspx to get a trial license. --> | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v2/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v3/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
<script> | ||
@@ -472,5 +498,5 @@ let scanner = null; | ||
> **Possible Issue**: Generally you need to provide a resolution that the camera supports. However, in case a camera does not support a specified resolution, it usually will just use the nearest supported resolution. As a result, the selected resolution may not be the actual resolution. | ||
> **Possible Issue**: : Generally you need to provide a resolution that the camera supports. However, in case a camera does not support a specified resolution, it usually will just use the nearest supported resolution. As a result, the selected resolution may not be the actual resolution. | ||
> | ||
> **How to tackle it**: To take care of this issue, you can add an option with the class name `dbrScanner-opt-gotResolution` (as shown above) which the library will then use to show the actual resolution being used. | ||
> **Solution**: To take care of this issue, you can add an option with the class name `dbrScanner-opt-gotResolution` (as shown above) which the library will then use to show the actual resolution being used. | ||
@@ -598,3 +624,3 @@ [Try in JSFiddle](https://jsfiddle.net/DynamsoftTeam/tnfjks4q/) | ||
* Using a percentage is easier | ||
* The following code ignores 25% to each side of the video stream | ||
* The following code shrinks the decoding region by 25% on all sides | ||
*/ | ||
@@ -617,6 +643,4 @@ settings.region.regionMeasuredByPercentage = 1; | ||
On your server put the following files in the same directory. | ||
Locate the following files and place them in the same directory on your server. You can get them in `dist/`. | ||
> [Download zip](https://www.dynamsoft.com/Downloads/Dynamic-Barcode-Reader-Download.aspx?edition=js) to get these files. | ||
``` | ||
@@ -635,5 +659,5 @@ dbr.js // For <script> | ||
Make sure that your webserver serves the `*.wasm` file with `Content-Type: application/wasm` . Otherwise the browser won't be able to recognize it. | ||
Make sure that your webserver serves the `*.wasm` file with `Content-Type: application/wasm`. Otherwise, the browser won't be able to recognize it. | ||
Basically, all you need to do is set the MIME type for `.wasm` to `application/wasm`. | ||
All you need to do is set the MIME type for `.wasm` to `application/wasm`. | ||
@@ -649,3 +673,3 @@ > Different servers are configured differently, below lists a few popular ones | ||
If the resource files like the `wasm` files are not placed in the same directory as the file `dbr.min.js`. Then you will need to specify the path with the API `engineResourcePath`. Note that it must be set before `loadWasm` or `createInstance`. | ||
If the resource files like the `wasm` files are not placed in the same directory as the file `dbr.min.js`. Then you will need to specify the path with the API `engineResourcePath`. Note that it must be set before `loadWasm` or `createInstance` is called. | ||
```js | ||
@@ -663,13 +687,13 @@ Dynamsoft.BarcodeReader.engineResourcePath = "url/to/the/dir/"; | ||
* If you are using a CDN, just make sure to change the version number in the URL like this | ||
* If you are using a CDN, be sure to change the version number in the URL like this | ||
```javascript | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v2/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v3/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
``` | ||
* If you have deployed the library files on your own server, you'll need to replace the old files with the ones from the new version. Download the latest version [here](https://www.dynamsoft.com/Downloads/Dynamic-Barcode-Reader-Download.aspx). | ||
* If you have deployed the library files on your own server, you'll need to replace the old files with the new version. Download the latest version [here](https://www.dynamsoft.com/Downloads/Dynamic-Barcode-Reader-Download.aspx). | ||
#### From versions prior to`7.2.2-v2` to `7.3.0-v0` | ||
Dynamsoft made quite some changes in the version `7.2.2-v2`, therefore it may take a bit more effort to upgrade the library from an older version to the version `7.2.2-v2` or a later version including the latest `7.3.0-v0` (as of January, 2020). Apart from changing the code to include the correct version of the library, you'll also need to make changes to your code related to the APIs of the library. Check out [this post](https://blog.dynamsoft.com/insights/dynamsoft-barcode-reader-sdk-for-javascript-upgrade-from-v7-1-3-to-v7-2-2/) for more information. If you need more help with the upgrade, please feel free to contact [Dynamsoft Support](#contact-us). | ||
Dynamsoft made several changes in the version `7.2.2-v2`; therefore it may take a bit more effort to upgrade the library from an older version to the version `7.2.2-v2` or a later version including the latest `7.3.0-v0` (as of January 2020). Apart from changing the code to include the correct version of the library, you'll also need to make changes to your code related to the APIs of the library. Check out [this post](https://blog.dynamsoft.com/insights/dynamsoft-barcode-reader-sdk-for-javascript-upgrade-from-v7-1-3-to-v7-2-2/) for more information. If you need further assistance with the upgrade, please feel free to contact [Dynamsoft Support](#contact-us). | ||
@@ -690,7 +714,7 @@ | ||
It takes several steps to activate a purchased license, the following steps assume you have already acquired a commercial license from Dynamsoft. If you haven't done so, you can purchase [here](https://www.dynamsoft.com/Secure/Barcode-Reader-BuyIt.aspx). | ||
It takes several steps to activate a purchased license, the following steps assume you have already acquired a commercial license from Dynamsoft. If you haven't done so yet, you can purchase a license [here](https://www.dynamsoft.com/Secure/Barcode-Reader-BuyIt.aspx). | ||
* **Step One** : Create a Dynamsoft account | ||
If you don't have an account yet, sign up [here](https://www.dynamsoft.com/CustomerPortal/Account/Registration.aspx), make sure to use the same email that was registered for the purchase. | ||
If you don't have an Dynamsoft account, sign up [here](https://www.dynamsoft.com/CustomerPortal/Account/Registration.aspx). Be sure to use the same email that was registered for the purchase. | ||
@@ -703,3 +727,3 @@ * **Step Two** : Log into Dynamsoft Customer Portal | ||
Under **Status**, click the link **Activate Now** to input a domain which your license key will be bound to. The domain binding is a security feature to protect your license, although it's optional, it's highly recommended. | ||
Under **Status**, click the link **Activate Now** to specify a domain which your license key will be bound to. The domain binding is a security feature to protect your license, although it's optional, it's highly recommended. | ||
@@ -722,6 +746,6 @@ > A few examples of the domain | ||
<!-- Please visit https://www.dynamsoft.com/CustomerPortal/Portal/TrialLicense.aspx to get a trial license. --> | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v2/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.3.0-v3/dist/dbr.js" data-productKeys="PRODUCT-KEYS"></script> | ||
``` | ||
To use your license, you simply need to replace `PRODUCT-KEYS` with it. | ||
To use your activated key, you simply need to replace `PRODUCT-KEYS` with it. | ||
@@ -728,0 +752,0 @@ ## License Agreement |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 3 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 3 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
12238777
16873
726