dynamsoft-barcode-reader-bundle 10.4.2002 → 10.4.3100-beta-202501012302

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,54 +21,54 @@ In this guide, you will learn step by step on how to integrate the DBR-JS SDK in
21
21
  - [Understand the code](#understand-the-code)
22
22
  - [About the code](#about-the-code)
23
23
  - [Run the example](#run-the-example)
24
- - [Building your own page](#building-your-own-page)
25
- - [Include the SDK](#include-the-sdk)
26
- - [Use a public CDN](#use-a-public-cdn)
27
- - [Host the SDK yourself (optional)](#host-the-sdk-yourself-optional)
28
- - [Prepare the SDK](#prepare-the-sdk)
29
- - [Specify the license](#specify-the-license)
30
- - [Specify the location of the "engine" files (optional)](#specify-the-location-of-the-engine-files-optional)
31
- - [Set up and start image processing](#set-up-and-start-image-processing)
32
- - [Preload the module](#preload-the-module)
33
- - [Create a CaptureVisionRouter object](#create-a-capturevisionrouter-object)
34
- - [Connect an image source](#connect-an-image-source)
35
- - [Register a result receiver](#register-a-result-receiver)
36
- - [Start the process](#start-the-process)
37
- - [Customize the process](#customize-the-process)
38
- - [Adjust the preset template settings](#adjust-the-preset-template-settings)
39
- - [Change barcode settings](#change-barcode-settings)
40
- - [Retrieve the original image](#retrieve-the-original-image)
41
- - [Change reading frequency to save power](#change-reading-frequency-to-save-power)
42
- - [Specify a scan region](#specify-a-scan-region)
43
- - [Edit the preset templates directly](#edit-the-preset-templates-directly)
44
- - [Filter the results (Important)](#filter-the-results-important)
45
- - [Option 1: Verify results across multiple frames](#option-1-verify-results-across-multiple-frames)
46
- - [Option 2: Eliminate redundant results detected within a short time frame](#option-2-eliminate-redundant-results-detected-within-a-short-time-frame)
47
- - [Add feedback](#add-feedback)
48
- - [Customize the UI](#customize-the-ui)
49
- - [API Documentation](#api-documentation)
50
- - [System Requirements](#system-requirements)
51
- - [How to Upgrade](#how-to-upgrade)
52
- - [Release Notes](#release-notes)
24
+ - [Preparing the SDK](#preparing-the-sdk)
25
+ - [Step 1: Include the SDK](#step-1-include-the-sdk)
26
+ - [Option 1: Use a public CDN](#option-1-use-a-public-cdn)
27
+ - [Option 2: Host the SDK yourself (optional)](#option-2-host-the-sdk-yourself-optional)
28
+ - [Step 2: Prepare the SDK](#step-2-prepare-the-sdk)
29
+ - [1. Specify the license](#1-specify-the-license)
30
+ - [2. \[Optional\] Specify the location of the "engine" files](#2-optional-specify-the-location-of-the-engine-files)
31
+ - [Using the SDK](#using-the-sdk)
32
+ - [Step 1: Preload the module](#step-1-preload-the-module)
33
+ - [Step 2: Create a CaptureVisionRouter object](#step-2-create-a-capturevisionrouter-object)
34
+ - [Step 3: Connect an image source](#step-3-connect-an-image-source)
35
+ - [Step 4: Register a result receiver](#step-4-register-a-result-receiver)
36
+ - [Step 5: Start process video frames](#step-5-start-process-video-frames)
37
+ - [Customizing the process](#customizing-the-process)
38
+ - [1. Adjust the preset template settings](#1-adjust-the-preset-template-settings)
39
+ - [1.1. Change barcode settings](#11-change-barcode-settings)
40
+ - [1.2. Retrieve the original image](#12-retrieve-the-original-image)
41
+ - [1.3. Change reading frequency to save power](#13-change-reading-frequency-to-save-power)
42
+ - [1.4. Specify a scan region](#14-specify-a-scan-region)
43
+ - [2. Edit the preset templates directly](#2-edit-the-preset-templates-directly)
44
+ - [3. \[Important\] Filter the results](#3-important-filter-the-results)
45
+ - [Method 1: Verify results across multiple frames](#method-1-verify-results-across-multiple-frames)
46
+ - [Method 2: Eliminate redundant results detected within a short time frame](#method-2-eliminate-redundant-results-detected-within-a-short-time-frame)
47
+ - [4. Add feedback](#4-add-feedback)
48
+ - [Customizing the UI](#customizing-the-ui)
49
+ - [Documentation](#documentation)
50
+ - [API Reference](#api-reference)
51
+ - [How to Upgrade](#how-to-upgrade)
52
+ - [Release Notes](#release-notes)
53
53
  - [Next Steps](#next-steps)
54
54
 
55
55
  **Popular Examples**
56
56
 
57
- - Hello World - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/hello-world.html) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/hello-world.html?ver=10.4.20&utm_source=npm)
58
- - Angular App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/angular)
59
- - React App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/react)
60
- - Vue App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/vue)
61
- - PWA App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/pwa)
62
- - WebView in Android and iOS - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/tree/v10.4.20/hello-world/webview)
63
- - Read Driver Licenses - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/read-a-drivers-license/index.html)
64
- - Fill A Form - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/fill-a-form-with-barcode-reading.html)
65
- - Show result information on the video - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/show-result-texts-on-the-video.html)
66
- - Debug Camera and Collect Video Frame - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/others/debug)
57
+ - Hello World - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.31/hello-world/hello-world.html) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/hello-world.html?ver=10.4.31&utm_source=npm)
58
+ - Angular App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.31/hello-world/angular)
59
+ - React App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.31/hello-world/react)
60
+ - Vue App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.31/hello-world/vue)
61
+ - PWA App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.31/hello-world/pwa) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/pwa/helloworld-pwa.html?ver=10.4.31&utm_source=npm)
62
+ - WebView in Android and iOS - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/tree/v10.4.31/hello-world/webview)
63
+ - Read Driver Licenses - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.31/use-case/read-a-drivers-license/index.html) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/use-case/read-a-drivers-license/index.html?ver=10.4.31&utm_source=npm)
64
+ - Fill A Form - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.31/use-case/fill-a-form-with-barcode-reading.html) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/use-case/fill-a-form-with-barcode-reading.html?ver=10.4.31&utm_source=npm)
65
+ - Show result information on the video - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.31/use-case/show-result-texts-on-the-video.html) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/use-case/show-result-texts-on-the-video.html?ver=10.4.31&utm_source=npm)
66
+ - Debug Camera and Collect Video Frame - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.31/others/debug)
67
67
 
68
68
  You can also:
69
69
 
70
- - Try the Official Demo - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-demo/) \| [Run](https://demo.dynamsoft.com/barcode-reader-js/?ver=10.4.20&utm_source=npm)
71
- - Try Online Examples - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/tree/v10.4.20/)
70
+ - Try the Official Demo - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-demo/) \| [Run](https://demo.dynamsoft.com/barcode-reader-js/?ver=10.4.31&utm_source=npm)
71
+ - Try Online Examples - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/tree/v10.4.31/)
72
72
 
73
73
  ## Hello World - Simplest Implementation
74
74
 
@@ -76,7 +76,7 @@ Let's start with the "Hello World" example of the DBR-JS SDK which demonstrates
76
76
 
77
77
  **Basic Requirements**
78
78
  - Internet connection
79
- - [A supported browser](#system-requirements)
79
+ - A supported browser
80
80
  - Camera access
81
81
 
82
82
  ### Understand the code
@@ -89,7 +89,7 @@ The complete code of the "Hello World" example is shown below
89
89
  <body>
90
90
  <div id="camera-view-container" style="width: 100%; height: 60vh"></div>
91
91
  <textarea id="results" style="width: 100%; min-height: 10vh; font-size: 3vmin; overflow: auto" disabled></textarea>
92
- <script src="https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@10.4.2002/dist/dbr.bundle.js"></script>
92
+ <script src="https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@10.4.3100/dist/dbr.bundle.js"></script>
93
93
  <script>
94
94
  Dynamsoft.License.LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9");
95
95
  Dynamsoft.Core.CoreModule.loadWasm(["dbr"]);
@@ -102,8 +102,8 @@ The complete code of the "Hello World" example is shown below
102
102
  cvRouter.setInput(cameraEnhancer);
103
103
 
104
104
  const resultsContainer = document.querySelector("#results");
105
- cvRouter.addResultReceiver({ onDecodedBarcodesReceived: (result) => {
106
- if (result.barcodeResultItems.length > 0) {
105
+ cvRouter.addResultReceiver({ onCapturedResultReceived: (result) => {
106
+ if (result.barcodeResultItems?.length) {
107
107
  resultsContainer.textContent = '';
108
108
  for (let item of result.barcodeResultItems) {
109
109
  resultsContainer.textContent += `${item.formatString}: ${item.text}\n\n`;
@@ -127,7 +127,7 @@ The complete code of the "Hello World" example is shown below
127
127
  <!--TOM: Update the code links-->
128
128
 
129
129
  <p align="center" style="text-align:center; white-space: normal; ">
130
- <a target="_blank" href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/hello-world.html" title="Code in Github" style="text-decoration:none;">
130
+ <a target="_blank" href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.31/hello-world/hello-world.html" title="Code in Github" style="text-decoration:none;">
131
131
  <img src="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/github.svg" alt="Code in Github" width="20" height="20" style="width:20px;height:20px;">
132
132
  </a>
133
133
  &nbsp;
@@ -135,7 +135,7 @@ The complete code of the "Hello World" example is shown below
135
135
  <img src="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/jsfiddle.svg" alt="Run via JSFiddle" width="20" height="20" style="width:20px;height:20px;" >
136
136
  </a>
137
137
  &nbsp;
138
- <a target="_blank" href="https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/hello-world.html?ver=10.4.20&utm_source=npm" title="Run in Dynamsoft" style="text-decoration:none;">
138
+ <a target="_blank" href="https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/hello-world.html?ver=10.4.31&utm_source=npm" title="Run in Dynamsoft" style="text-decoration:none;">
139
139
  <img src="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.0.0/svgs/solid/circle-play.svg" alt="Run in Dynamsoft" width="20" height="20" style="width:20px;height:20px;">
140
140
  </a>
141
141
  </p>
@@ -182,7 +182,7 @@ The complete code of the "Hello World" example is shown below
182
182
 
183
183
  ### Run the example
184
184
 
185
- You can run the example deployed to [the Dynamsoft Demo Server](https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/hello-world.html?ver=10.4.20&utm_source=npm) or test it with [JSFiddle code editor](https://jsfiddle.net/DynamsoftTeam/csm2f9wb/).
185
+ You can run the example deployed to [the Dynamsoft Demo Server](https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/hello-world.html?ver=10.4.31&utm_source=npm) or test it with [JSFiddle code editor](https://jsfiddle.net/DynamsoftTeam/csm2f9wb/).
186
186
 
187
187
  You will be asked to allow access to your camera, after which the video will be displayed on the page. After that, you can point the camera at a barcode to read it.
188
188
 
@@ -190,125 +190,99 @@ When a barcode is decoded, you will see the result text show up under the video
190
190
 
191
191
  Alternatively, you can test locally by copying and pasting the code shown above into a local file (e.g. "hello-world.html") and opening it in your browser.
192
192
 
193
- *Note*:
194
-
195
- If you open the web page as `file:///` or `http://` , the camera may not work correctly because the [MediaDevices: getUserMedia()](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) method only works in secure contexts (HTTPS), in some or all supporting browsers.
196
-
197
- To make sure your web application can access the camera, please configure your web server to support HTTPS. The following links may help.
198
-
199
- 1. NGINX: [Configuring HTTPS servers](https://nginx.org/en/docs/http/configuring_https_servers.html)
200
- 2. IIS: [How to create a Self Signed Certificate in IIS](https://aboutssl.org/how-to-create-a-self-signed-certificate-in-iis/)
201
- 3. Tomcat: [Setting Up SSL on Tomcat in 5 minutes](https://dzone.com/articles/setting-ssl-tomcat-5-minutes)
202
- 4. Node.js: [npm tls](https://nodejs.org/docs/v0.4.1/api/tls.html)
203
-
204
- If the test doesn't go as expected, you can [contact us](https://www.dynamsoft.com/company/contact/?ver=10.4.20&utm_source=npm&product=dbr&package=js).
193
+ > *Secure Contexts*:
194
+ >
195
+ > If you open the web page as `http://` , our SDK may not work correctly because the [MediaDevices: getUserMedia()](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) and other methods only work in [secure contexts](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts) (HTTPS, `localhost`, `127.0.0.1`, `file://`), in some or all supporting browsers.
196
+ >
197
+ > Regarding configuring https on your server, these guides for [nginx](https://nginx.org/en/docs/http/configuring_https_servers.html) / [IIS](https://aboutssl.org/how-to-create-a-self-signed-certificate-in-iis/) / [tomcat](https://dzone.com/articles/setting-ssl-tomcat-5-minutes) / [nodejs](https://nodejs.org/docs/v0.4.1/api/tls.html) might help.
198
+ >
199
+ > If the test doesn't go as expected, you can [contact us](https://www.dynamsoft.com/company/contact/?ver=10.4.31&utm_source=npm&product=dbr&package=js).
205
200
 
206
- ## Building your own page
201
+ ## Preparing the SDK
207
202
 
208
- ### Include the SDK
203
+ ### Step 1: Include the SDK
209
204
 
210
- To utilize the SDK, the initial step involves including the corresponding resource files:
211
-
212
- * `core.js` encompasses common classes, interfaces, and enumerations shared across all Dynamsoft SDKs.
213
- * `license.js` introduces the `LicenseManager` class, which manages the licensing for all Dynamsoft SDKs.
214
- * `utility.js` encompasses auxiliary classes shared among all Dynamsoft SDKs.
215
- * `dbr.js` defines interfaces and enumerations tailored to the barcode reader module.
216
- * `cvr.js` introduces the `CaptureVisionRouter` class, which governs the entire image processing workflow.
217
- * `dce.js` comprises classes that offer camera support and basic user interface functionalities.
218
-
219
- To simplify things, starting from version 10.0.21, we introduced `dbr.bundle.js`, which combines all six of the above files. In the following chapters, we will use `dbr.bundle.js`.
220
-
221
- #### Use a public CDN
205
+ #### Option 1: Use a public CDN
222
206
 
223
207
  The simplest way to include the SDK is to use either the [jsDelivr](https://jsdelivr.com/) or [UNPKG](https://unpkg.com/) CDN. The "hello world" example above uses **jsDelivr**.
224
208
 
225
209
  - jsDelivr
226
210
 
227
211
  ```html
228
- <script src="https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@10.4.2002/dist/dbr.bundle.js"></script>
212
+ <script src="https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@10.4.3100/dist/dbr.bundle.js"></script>
229
213
  ```
230
214
 
231
215
  - UNPKG
232
216
 
233
217
  ```html
234
- <script src="https://unpkg.com/dynamsoft-barcode-reader-bundle@10.4.2002/dist/dbr.bundle.js"></script>
218
+ <script src="https://unpkg.com/dynamsoft-barcode-reader-bundle@10.4.3100/dist/dbr.bundle.js"></script>
235
219
  ```
236
220
 
237
221
  - In some rare cases (such as some restricted areas), you might not be able to access the CDN. If this happens, you can use the following files for the test.
238
222
 
239
223
  ```html
240
- <script src="https://download2.dynamsoft.com/packages/dynamsoft-barcode-reader-bundle@10.4.2002/dist/dbr.bundle.js"></script>
224
+ <script src="https://download2.dynamsoft.com/packages/dynamsoft-barcode-reader-bundle@10.4.3100/dist/dbr.bundle.js"></script>
241
225
  ```
242
226
 
243
227
  However, please **DO NOT** use `download2.dynamsoft.com` resources in a production application as they are for temporary testing purposes only. Instead, you can try hosting the SDK yourself.
244
228
 
245
- - In frameworks like React and Vue, you may want to add the package as a dependency.
229
+ - In frameworks like React, Vue and Angular, you may want to add the package as a dependency.
246
230
 
247
231
  ```sh
248
- npm i dynamsoft-barcode-reader-bundle@10.4.2002 -E
232
+ npm i dynamsoft-barcode-reader-bundle@10.4.3100 -E
249
233
  # or
250
- yarn add dynamsoft-barcode-reader-bundle@10.4.2002 -E
234
+ yarn add dynamsoft-barcode-reader-bundle@10.4.3100 -E
251
235
  ```
252
236
 
253
237
  NOTE that in frameworks, you need to [specify the engineResourcePaths](#specify-the-location-of-the-engine-files-optional).
254
238
 
255
- #### Host the SDK yourself (optional)
239
+ #### Option 2: Host the SDK yourself (optional)
256
240
 
257
241
  Besides using the public CDN, you can also download the SDK and host its files on your own server or a commercial CDN before including it in your application.
258
242
 
259
- There are two options for downloading the SDK, and the usage for each is slightly different
260
-
261
243
  - From the website
262
244
 
263
- [Download Dynamsoft Barcode Reader JavaScript Package](https://www.dynamsoft.com/barcode-reader/downloads/?ver=10.4.20&utm_source=npm&product=dbr&package=js)
245
+ [Download Dynamsoft Barcode Reader JavaScript Package](https://www.dynamsoft.com/barcode-reader/downloads/?ver=10.4.31&utm_source=npm&product=dbr&package=js)
264
246
 
265
- The resources are located at path `dynamsoft/distributables/<pkg>@<version>`, you can typically include it like this:
247
+ The resources are located at path `dynamsoft/distributables/<pkg>@<version>`.
266
248
 
267
- ```html
268
- <script src="dynamsoft/distributables/dynamsoft-barcode-reader-bundle@10.4.2002/dist/dbr.bundle.js"></script>
269
- ```
270
-
271
- - npm
249
+ - From npm
272
250
 
273
251
  ```sh
274
- npm i dynamsoft-barcode-reader-bundle@10.4.2002 -E
252
+ npm i dynamsoft-barcode-reader-bundle@10.4.3100 -E
275
253
  # Compared with using CDN, you need to set up more resources.
276
- npm i dynamsoft-capture-vision-std@1.4.10 -E
277
- npm i dynamsoft-image-processing@2.4.20 -E
254
+ npm i dynamsoft-capture-vision-std@1.4.21 -E
255
+ npm i dynamsoft-image-processing@2.4.31 -E
278
256
  ```
279
257
 
280
- The resources are located at the path `node_modules/<pkg>`, without `@<version>`, so the script would be like:
258
+ The resources are located at the path `node_modules/<pkg>`, without `@<version>`. You must copy "dynamsoft-xxx" packages elsewhere and add `@<version>`. The `<version>` can be obtained from `package.json` of each package. Another thing to do is to [specify the engineResourcePaths](#2-optional-specify-the-location-of-the-engine-files) so that the SDK can correctly locate the resources.
259
+ > Since "node_modules" is reserved for Node.js dependencies, and in our case the package is used only as static resources, we recommend either renaming the "node_modules" folder or moving the "dynamsoft-" packages to a dedicated folder for static resources in your project to facilitate self-hosting.
281
260
 
282
- ```html
283
- <script src="node_modules/dynamsoft-barcode-reader-bundle/dist/dbr.bundle.js"></script>
284
- ```
285
-
286
- Since the version tags (`@<version>`) are missing, you need to [specify the engineResourcePaths](#specify-the-location-of-the-engine-files-optional) so that the SDK can find the resources correctly.
261
+ You can typically include SDK like this:
287
262
 
288
- > To avoid confusion, we suggest renaming "node_modules" or moving "dynamsoft-" packages elsewhere for self-hosting, as "node_modules" is reserved for Node.js dependencies.
263
+ ```html
264
+ <script src="path/to/dynamsoft-barcode-reader-bundle@10.4.3100/dist/dbr.bundle.js"></script>
265
+ ```
289
266
 
290
267
  *Note*:
291
268
 
292
269
  * Certain legacy web application servers may lack support for the `application/wasm` mimetype for .wasm files. To address this, you have two options:
293
270
  1. Upgrade your web application server to one that supports the `application/wasm` mimetype.
294
- 2. Manually define the mimetype on your server. You can refer to the following resources for guidance:
295
- 1. [Apache](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Apache_Configuration_htaccess#media_types_and_character_encodings)
296
- 2. [IIS](https://docs.microsoft.com/en-us/iis/configuration/system.webserver/staticcontent/mimemap)
297
- 3. [Nginx](https://www.nginx.com/resources/wiki/start/topics/examples/full/#mime-types)
271
+ 2. Manually define the mimetype on your server. You can refer to the guides for [apache](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Apache_Configuration_htaccess#media_types_and_character_encodings) / [IIS](https://docs.microsoft.com/en-us/iis/configuration/system.webserver/staticcontent/mimemap) / [nginx](https://www.nginx.com/resources/wiki/start/topics/examples/full/#mime-types).
298
272
 
299
273
  * To work properly, the SDK requires a few engine files, which are relatively large and may take quite a few seconds to download. We recommend that you set a longer cache time for these engine files, to maximize the performance of your web application.
300
274
 
301
- ```cmd
275
+ ```
302
276
  Cache-Control: max-age=31536000
303
277
  ```
304
278
 
305
279
  Reference: [Cache-Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control).
306
280
 
307
- ### Prepare the SDK
281
+ ### Step 2: Prepare the SDK
308
282
 
309
283
  Before using the SDK, you need to configure a few things.
310
284
 
311
- #### Specify the license
285
+ #### 1. Specify the license
312
286
 
313
287
  To enable the SDK's functionality, you must provide a valid license. Utilize the API function initLicense to set your license key.
314
288
 
@@ -316,24 +290,30 @@ To enable the SDK's functionality, you must provide a valid license. Utilize the
316
290
  Dynamsoft.License.LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9");
317
291
  ```
318
292
 
319
- As previously stated, the key "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" serves as a test license valid for 24 hours, applicable to any newly authorized browser. To test the SDK further, you can request a 30-day free trial license via the <a href="https://www.dynamsoft.com/customer/license/trialLicense?ver=10.4.20&utm_source=npm&product=dbr&package=js" target="_blank">Request a Trial License</a> link.
293
+ As previously stated, the key "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" serves as a test license valid for 24 hours, applicable to any newly authorized browser. To test the SDK further, you can request a 30-day free trial license via the <a href="https://www.dynamsoft.com/customer/license/trialLicense?ver=10.4.31&utm_source=npm&product=dbr&package=js" target="_blank">Request a Trial License</a> link.
320
294
 
321
295
  > Upon registering a Dynamsoft account and obtaining the SDK package from the official website, Dynamsoft will automatically create a 30-day free trial license and embed the corresponding license key into all the provided SDK samples.
322
296
 
323
- #### Specify the location of the "engine" files (optional)
297
+ #### 2. [Optional] Specify the location of the "engine" files
324
298
 
325
- This is usually only required with frameworks like Angular or React, etc. where the referenced JavaScript files such as `cvr.js`, `dbr.js` are compiled into another file.
299
+ This is usually only required with frameworks like Angular, React or Vue.
326
300
 
327
- The purpose is to tell the SDK where to find the engine files (\*.worker.js, \*.wasm.js and \*.wasm, etc.). The API is called `Dynamsoft.Core.CoreModule.engineResourcePaths`:
301
+ The purpose is to tell the SDK where to find the engine files (\*.worker.js, \*.wasm.js and \*.wasm, etc.).
328
302
 
329
- ```javascript
330
- //The following code uses the jsDelivr CDN as an example, feel free to change it to your own location of these files
303
+ ```ts
304
+ // in framework
305
+ import { CoreModule } from "dynamsoft-barcode-reader-bundle";
331
306
  CoreModule.engineResourcePaths.rootDirectory = "https://cdn.jsdelivr.net/npm/";
332
307
  ```
308
+ ```js
309
+ // in pure js
310
+ Dynamsoft.Core.CoreModule.engineResourcePaths.rootDirectory = "https://cdn.jsdelivr.net/npm/";
311
+ ```
312
+ These code uses the jsDelivr CDN as an example, feel free to change it to your own location.
333
313
 
334
- ### Set up and start image processing
314
+ ## Using the SDK
335
315
 
336
- #### Preload the module
316
+ ### Step 1: Preload the module
337
317
 
338
318
  The image processing logic is encapsulated within .wasm library files, and these files may require some time for downloading. To enhance the speed, we advise utilizing the following method to preload the libraries.
339
319
 
@@ -342,7 +322,7 @@ The image processing logic is encapsulated within .wasm library files, and these
342
322
  await Dynamsoft.Core.CoreModule.loadWasm(["dbr"]);
343
323
  ```
344
324
 
345
- #### Create a CaptureVisionRouter object
325
+ ### Step 2: Create a CaptureVisionRouter object
346
326
 
347
327
  To use the SDK, we first create a `CaptureVisionRouter` object.
348
328
 
@@ -376,7 +356,7 @@ document.getElementById('btn-scan').addEventListener('click', async () => {
376
356
  });
377
357
  ```
378
358
 
379
- #### Connect an image source
359
+ ### Step 3: Connect an image source
380
360
 
381
361
  The `CaptureVisionRouter` object, denoted as `cvRouter`, is responsible for handling images provided by an image source. In our scenario, we aim to detect barcodes directly from a live video stream. To facilitate this, we initialize a `CameraEnhancer` object, identified as `cameraEnhancer`, which is specifically designed to capture image frames from the video feed and subsequently forward them to `cvRouter`.
382
362
 
@@ -393,15 +373,16 @@ document.querySelector("#camera-view-container").append(cameraView.getUIElement(
393
373
  cvRouter.setInput(cameraEnhancer);
394
374
  ```
395
375
 
396
- #### Register a result receiver
376
+ ### Step 4: Register a result receiver
397
377
 
398
- Once the image processing is complete, the results are sent to all the registered `CapturedResultReceiver` objects. Each `CapturedResultReceiver` object may encompass one or multiple callback functions associated with various result types. In our particular case, our focus is on identifying barcodes within the images, so it's sufficient to define the callback function `onDecodedBarcodesReceived`:
378
+ Once the image processing is complete, the results are sent to all the registered `CapturedResultReceiver` objects. Each `CapturedResultReceiver` object may encompass one or multiple callback functions associated with various result types. This time we use `onCapturedResultReceived`:
379
+ <!--In our particular case, our focus is on identifying barcodes within the images, so it's sufficient to define the callback function `onDecodedBarcodesReceived`:-->
399
380
 
400
381
  ```javascript
401
382
  const resultsContainer = document.querySelector("#results");
402
383
  const resultReceiver = new Dynamsoft.CVR.CapturedResultReceiver();
403
- resultReceiver.onDecodedBarcodesReceived = (result) => {
404
- if (result.barcodeResultItems.length > 0) {
384
+ resultReceiver.onCapturedResultReceived = (result) => {
385
+ if (result.barcodeResultItems?.length) {
405
386
  resultsContainer.textContent = '';
406
387
  for (let item of result.barcodeResultItems) {
407
388
  // In this example, the barcode results are displayed on the page below the video.
@@ -416,8 +397,8 @@ You can also write code like this. It is the same.
416
397
 
417
398
  ```javascript
418
399
  const resultsContainer = document.querySelector("#results");
419
- cvRouter.addResultReceiver({ onDecodedBarcodesReceived: (result) => {
420
- if (result.barcodeResultItems.length > 0) {
400
+ cvRouter.addResultReceiver({ onCapturedResultReceived: (result) => {
401
+ if (result.barcodeResultItems?.length) {
421
402
  resultsContainer.textContent = '';
422
403
  for (let item of result.barcodeResultItems) {
423
404
  // In this example, the barcode results are displayed on the page below the video.
@@ -429,7 +410,7 @@ cvRouter.addResultReceiver({ onDecodedBarcodesReceived: (result) => {
429
410
 
430
411
  Check out [CapturedResultReceiver](https://www.dynamsoft.com/capture-vision/docs/web/programming/javascript/api-reference/capture-vision-router/captured-result-receiver.html) for more information.
431
412
 
432
- #### Start the process
413
+ ### Step 5: Start process video frames
433
414
 
434
415
  With the setup now complete, we can proceed to process the images in two straightforward steps:
435
416
 
@@ -458,13 +439,13 @@ await cvRouter.startCapturing("ReadSingleBarcode");
458
439
 
459
440
  Read more on the [preset CaptureVisionTemplates](https://www.dynamsoft.com/capture-vision/docs/web/programming/javascript/api-reference/capture-vision-router/preset-templates.html).
460
441
 
461
- ### Customize the process
442
+ ## Customizing the process
462
443
 
463
- #### Adjust the preset template settings
444
+ ### 1. Adjust the preset template settings
464
445
 
465
446
  When making adjustments to some basic tasks, we often only need to modify [SimplifiedCaptureVisionSettings](https://www.dynamsoft.com/capture-vision/docs/web/programming/javascript/api-reference/capture-vision-router/interfaces/simplified-capture-vision-settings.html).
466
447
 
467
- ##### Change barcode settings
448
+ #### 1.1. Change barcode settings
468
449
 
469
450
  The preset templates can be updated to meet different requirements. For example, the following code limits the barcode format to QR code.
470
451
 
@@ -478,7 +459,7 @@ await cvRouter.startCapturing("ReadSingleBarcode");
478
459
 
479
460
  For a list of adjustable barcode settings, check out [SimplifiedBarcodeReaderSettings](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/interfaces/simplified-barcode-reader-settings.html).
480
461
 
481
- ##### Retrieve the original image
462
+ #### 1.2. Retrieve the original image
482
463
 
483
464
  Additionally, we have the option to modify the template to retrieve the original image containing the barcode.
484
465
 
@@ -506,8 +487,7 @@ Please be aware that it is necessary to update the `CapturedResultReceiver` obje
506
487
  ```javascript
507
488
  const EnumCRIT = Dynamsoft.Core.EnumCapturedResultItemType;
508
489
  resultReceiver.onCapturedResultReceived = (result) => {
509
- let barcodes = result.items.filter(item => item.type === EnumCRIT.CRIT_BARCODE);
510
- if (barcodes.length > 0) {
490
+ if (result.barcodeResultItems?.length) {
511
491
  // Use a filter to get the image on which barcodes are found.
512
492
  let image = result.items.filter(
513
493
  item => item.type === EnumCRIT.CRIT_ORIGINAL_IMAGE
@@ -516,7 +496,7 @@ resultReceiver.onCapturedResultReceived = (result) => {
516
496
  };
517
497
  ```
518
498
 
519
- ##### Change reading frequency to save power
499
+ #### 1.3. Change reading frequency to save power
520
500
 
521
501
  The SDK is initially configured to process images sequentially without any breaks. Although this setup maximizes performance, it can lead to elevated power consumption, potentially causing the device to overheat. In many cases, it's possible to reduce the reading speed while still satisfying business requirements. The following code snippet illustrates how to adjust the SDK to process an image every 500 milliseconds:
522
502
 
@@ -529,7 +509,7 @@ await cvRouter.updateSettings("ReadSingleBarcode", settings);
529
509
  await cvRouter.startCapturing("ReadSingleBarcode");
530
510
  ```
531
511
 
532
- ##### Specify a scan region
512
+ #### 1.4. Specify a scan region
533
513
 
534
514
  We can specify a scan region to allow the SDK to process only part of the image, improving processing speed. The code snippet below demonstrates how to do this using the `cameraEnhancer` image source.
535
515
 
@@ -588,11 +568,11 @@ await cvRouter.startCapturing("ReadSingleBarcode");
588
568
  ```
589
569
  -->
590
570
 
591
- #### Edit the preset templates directly
571
+ ### 2. Edit the preset templates directly
592
572
 
593
573
  The preset templates have many more settings that can be customized to suit your use case best. If you [download the SDK from Dynamsoft website](https://www.dynamsoft.com/barcode-reader/downloads/1000003-confirmation/), you can find the templates under
594
574
 
595
- * "/dynamsoft-barcode-reader-js-10.4.2002/dynamsoft/templates/"
575
+ * "/dynamsoft-barcode-reader-js-10.4.3100/dynamsoft/templates/"
596
576
 
597
577
  Upon completing the template editing, you can invoke the `initSettings` method and provide it with the template path as an argument.
598
578
 
@@ -601,11 +581,11 @@ await cvRouter.initSettings("PATH-TO-THE-FILE"); // E.g. "https://your-website/R
601
581
  await cvRouter.startCapturing("ReadSingleBarcode"); // Make sure the name matches one of the CaptureVisionTemplates in the template JSON file.
602
582
  ```
603
583
 
604
- #### Filter the results (Important)
584
+ ### 3. [Important] Filter the results
605
585
 
606
- While processing video frames, it's common for the same barcode to be detected multiple times. To enhance the user experience, we can use [MultiFrameResultCrossFilter](https://www.dynamsoft.com/capture-vision/docs/web/programming/javascript/api-reference/utility/multi-frame-result-cross-filter.html) object, having two options currently at our disposal:
586
+ When processing video frames, the same barcode is often detected multiple times. To improve the user experience, we can use the [MultiFrameResultCrossFilter](https://www.dynamsoft.com/capture-vision/docs/web/programming/javascript/api-reference/utility/multi-frame-result-cross-filter.html) object. This object provides two methods for handling duplicate detections, which can be used independently or together, depending on what best suits your application needs:
607
587
 
608
- ##### Option 1: Verify results across multiple frames
588
+ #### Method 1: Verify results across multiple frames
609
589
 
610
590
  ```js
611
591
  let filter = new Dynamsoft.Utility.MultiFrameResultCrossFilter();
@@ -617,7 +597,7 @@ await cvRouter.addResultFilter(filter);
617
597
 
618
598
  * `enableResultCrossVerification` was designed to cross-validate the outcomes across various frames in a video streaming scenario, enhancing the reliability of the final results. This validation is particularly crucial for barcodes with limited error correction capabilities, such as 1D codes.
619
599
 
620
- ##### Option 2: Eliminate redundant results detected within a short time frame
600
+ #### Method 2: Eliminate redundant results detected within a short time frame
621
601
 
622
602
  ```js
623
603
  let filter = new Dynamsoft.Utility.MultiFrameResultCrossFilter();
@@ -651,7 +631,7 @@ filter.setDuplicateForgetTime(5000);
651
631
  await cvRouter.addResultFilter(filter);
652
632
  ```
653
633
 
654
- #### Add feedback
634
+ ### 4. Add feedback
655
635
 
656
636
  When a barcode is detected within the video stream, its position is immediately displayed within the video. Furthermore, utilizing the "Dynamsoft Camera Enhancer" SDK, we can introduce feedback mechanisms, such as emitting a "beep" sound or triggering a "vibration".
657
637
 
@@ -667,14 +647,36 @@ resultReceiver.onDecodedBarcodesReceived = (result) => {
667
647
  cvRouter.addResultReceiver(resultReceiver);
668
648
  ```
669
649
 
670
- ### Customize the UI
650
+ ## Customizing the UI
651
+
652
+ ```javascript
653
+ // Create a CameraView instance with default settings
654
+ let cameraView = await Dynamsoft.DCE.CameraView.createInstance();
655
+ // Create a CameraView instance with a specified HTML file path, typically a local or remote URL
656
+ let cameraView1 = await Dynamsoft.DCE.CameraView.createInstance('@engineResourcePath/dce.mobile-native.ui.html');
657
+ // Create a CameraView instance within a specified DOM element
658
+ let cameraView2 = await Dynamsoft.DCE.CameraView.createInstance(document.getElementById('my-ui'));
659
+ // Create a CameraView instance using a custom UI file path
660
+ let cameraView3 = await Dynamsoft.DCE.CameraView.createInstance('url/to/my/ui.html');
661
+
662
+ // Get the UI element associated with the cameraView instance
663
+ let uiElement = cameraView.getUIElement();
664
+ // Remove the camera selection dropdown from the CameraView's UI element
665
+ uiElement.shadowRoot.querySelector('.dce-sel-camera').remove();
666
+ // Remove the resolution selection dropdown from the CameraView's UI element
667
+ uiElement.shadowRoot.querySelector('.dce-sel-resolution').remove();
668
+ ```
671
669
 
672
670
  The UI is part of the auxiliary SDK "Dynamsoft Camera Enhancer", read more on how to [customize the UI](https://www.dynamsoft.com/barcode-reader/docs/core/programming/features/ui-customization-js.html?lang=js).
673
671
 
674
- ## API Documentation
672
+ ## Documentation
673
+
674
+ ### API Reference
675
675
 
676
676
  You can check out the detailed documentation about the APIs of the SDK at
677
- [https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/?ver=10.4.2002](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/?ver=10.4.2002).
677
+ [https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/?ver=10.4.3100](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/?ver=10.4.3100).
678
+
679
+ <!-- Compatibility is basically not an issue. Pls remove to another place
678
680
 
679
681
  ## System Requirements
680
682
 
@@ -714,18 +716,20 @@ The following table is a list of supported browsers based on the above requireme
714
716
 
715
717
  Apart from the browsers, the operating systems may impose some limitations of their own that could restrict the use of the SDK. Browser compatibility ultimately depends on whether the browser on that particular operating system supports the features listed above.
716
718
 
717
- ## How to Upgrade
719
+ -->
720
+
721
+ ### How to Upgrade
718
722
 
719
- If you want to upgrade the SDK from an old version to a newer one, please see [how to upgrade](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/upgrade-guide/index.html?ver=10.4.2002&utm_source=npm).
723
+ If you want to upgrade the SDK from an old version to a newer one, please see [how to upgrade](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/upgrade-guide/index.html?ver=10.4.3100&utm_source=npm).
720
724
 
721
- ## Release Notes
725
+ ### Release Notes
722
726
 
723
- Learn about what are included in each release at [https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/release-notes/index.html](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/release-notes/index.html?ver=10.4.20&utm_source=npm).
727
+ Learn about what are included in each release at [https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/release-notes/index.html](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/release-notes/index.html?ver=10.4.31&utm_source=npm).
724
728
 
725
729
  ## Next Steps
726
730
 
727
731
  Now that you have got the SDK integrated, you can choose to move forward in the following directions
728
732
 
729
733
  1. Learn how to [Use in Framework](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/user-guide/use-in-framework.html)
730
- 2. Check out the [Official Samples and Demo](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/samples-demos/index.html?ver=10.4.20)
731
- 3. Learn about the [APIs of the SDK](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/index.html?ver=10.4.2002)
734
+ 2. Check out the [Official Samples and Demo](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/samples-demos/index.html?ver=10.4.31)
735
+ 3. Learn about the [APIs of the SDK](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/api-reference/index.html?ver=10.4.3100)