dynamsoft-barcode-reader-bundle 10.4.2002-beta-202410240008 → 10.4.2002-beta-202410300433
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.html +92 -104
- package/README.md +62 -62
- package/dist/dbr.bundle.js +2 -2
- package/dist/dbr.bundle.mjs +2 -2
- package/dist/dbr.no-content-bundle.esm.js +1 -1
- package/package.json +2 -2
package/README.html
CHANGED
|
@@ -262,7 +262,6 @@
|
|
|
262
262
|
<li><a href="#add-feedback">Add feedback</a></li>
|
|
263
263
|
<li><a href="#customize-the-ui">Customize the UI</a></li></ul></li>
|
|
264
264
|
<li><a href="#api-documentation">API Documentation</a></li>
|
|
265
|
-
<li><a href="#system-requirements">System Requirements</a></li>
|
|
266
265
|
<li><a href="#how-to-upgrade">How to Upgrade</a></li>
|
|
267
266
|
<li><a href="#release-notes">Release Notes</a></li>
|
|
268
267
|
<li><a href="#next-steps">Next Steps</a></li>
|
|
@@ -273,11 +272,11 @@
|
|
|
273
272
|
<li>Angular App - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/angular">Github</a></li>
|
|
274
273
|
<li>React App - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/react">Github</a></li>
|
|
275
274
|
<li>Vue App - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/vue">Github</a></li>
|
|
276
|
-
<li>PWA App - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/pwa">Github</a></li>
|
|
275
|
+
<li>PWA App - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/pwa">Github</a> | <a href="https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/pwa/helloworld-pwa.html?ver=10.4.20&utm_source=npm">Run</a></li>
|
|
277
276
|
<li>WebView in Android and iOS - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/tree/v10.4.20/hello-world/webview">Github</a></li>
|
|
278
|
-
<li>Read Driver Licenses - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/read-a-drivers-license/index.html">Github</a></li>
|
|
279
|
-
<li>Fill A Form - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/fill-a-form-with-barcode-reading.html">Github</a></li>
|
|
280
|
-
<li>Show result information on the video - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/show-result-texts-on-the-video.html">Github</a></li>
|
|
277
|
+
<li>Read Driver Licenses - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/read-a-drivers-license/index.html">Github</a> | <a href="https://demo.dynamsoft.com/Samples/DBR/JS/use-case/read-a-drivers-license/index.html?ver=10.4.20&utm_source=npm">Run</a></li>
|
|
278
|
+
<li>Fill A Form - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/fill-a-form-with-barcode-reading.html">Github</a> | <a href="https://demo.dynamsoft.com/Samples/DBR/JS/use-case/fill-a-form-with-barcode-reading.html?ver=10.4.20&utm_source=npm">Run</a></li>
|
|
279
|
+
<li>Show result information on the video - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/use-case/show-result-texts-on-the-video.html">Github</a> | <a href="https://demo.dynamsoft.com/Samples/DBR/JS/use-case/show-result-texts-on-the-video.html?ver=10.4.20&utm_source=npm">Run</a></li>
|
|
281
280
|
<li>Debug Camera and Collect Video Frame - <a href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/others/debug">Github</a></li>
|
|
282
281
|
</ul>
|
|
283
282
|
<p>You can also:</p>
|
|
@@ -313,8 +312,8 @@
|
|
|
313
312
|
cvRouter.setInput(cameraEnhancer);
|
|
314
313
|
|
|
315
314
|
<span class="hljs-keyword">const</span> resultsContainer = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">"#results"</span>);
|
|
316
|
-
cvRouter.addResultReceiver({ <span class="hljs-attr">
|
|
317
|
-
<span class="hljs-keyword">if</span> (result.barcodeResultItems
|
|
315
|
+
cvRouter.addResultReceiver({ <span class="hljs-attr">onCapturedResultReceived</span>: <span class="hljs-function">(<span class="hljs-params">result</span>) =></span> {
|
|
316
|
+
<span class="hljs-keyword">if</span> (result.barcodeResultItems?.length) {
|
|
318
317
|
resultsContainer.textContent = <span class="hljs-string">''</span>;
|
|
319
318
|
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> item <span class="hljs-keyword">of</span> result.barcodeResultItems) {
|
|
320
319
|
resultsContainer.textContent += <span class="hljs-string">`<span class="hljs-subst">${item.formatString}</span>: <span class="hljs-subst">${item.text}</span>\n\n`</span>;
|
|
@@ -393,28 +392,14 @@ cvRouter.addResultFilter(filter);
|
|
|
393
392
|
<p>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.</p>
|
|
394
393
|
<p>When a barcode is decoded, you will see the result text show up under the video and the barcode location will be highlighted in the video feed.</p>
|
|
395
394
|
<p>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.</p>
|
|
396
|
-
<
|
|
397
|
-
<p>
|
|
398
|
-
<p>
|
|
399
|
-
<
|
|
400
|
-
<
|
|
401
|
-
|
|
402
|
-
<li>Tomcat: <a href="https://dzone.com/articles/setting-ssl-tomcat-5-minutes">Setting Up SSL on Tomcat in 5 minutes</a></li>
|
|
403
|
-
<li>Node.js: <a href="https://nodejs.org/docs/v0.4.1/api/tls.html">npm tls</a></li>
|
|
404
|
-
</ol>
|
|
405
|
-
<p>If the test doesn't go as expected, you can <a href="https://www.dynamsoft.com/company/contact/?ver=10.4.20&utm_source=npm&product=dbr&package=js">contact us</a>.</p>
|
|
395
|
+
<blockquote>
|
|
396
|
+
<p><em>Secure Contexts</em>:</p>
|
|
397
|
+
<p>If you open the web page as <code>http://</code> , our SDK may not work correctly because the <a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia">MediaDevices: getUserMedia()</a> and other methods only work in <a href="https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts">secure contexts</a> (HTTPS, <code>localhost</code>, <code>127.0.0.1</code>, <code>file://</code>), in some or all supporting browsers.</p>
|
|
398
|
+
<p>Regarding configuring https on your server, these guides for <a href="https://nginx.org/en/docs/http/configuring_https_servers.html">nginx</a> / <a href="https://aboutssl.org/how-to-create-a-self-signed-certificate-in-iis/">IIS</a> / <a href="https://dzone.com/articles/setting-ssl-tomcat-5-minutes">tomcat</a> / <a href="https://nodejs.org/docs/v0.4.1/api/tls.html">nodejs</a> might help.</p>
|
|
399
|
+
<p>If the test doesn't go as expected, you can <a href="https://www.dynamsoft.com/company/contact/?ver=10.4.20&utm_source=npm&product=dbr&package=js">contact us</a>.</p>
|
|
400
|
+
</blockquote>
|
|
406
401
|
<h2 id="building-your-own-page">Building your own page</h2>
|
|
407
402
|
<h3 id="include-the-sdk">Include the SDK</h3>
|
|
408
|
-
<p>To utilize the SDK, the initial step involves including the corresponding resource files:</p>
|
|
409
|
-
<ul>
|
|
410
|
-
<li><code>core.js</code> encompasses common classes, interfaces, and enumerations shared across all Dynamsoft SDKs.</li>
|
|
411
|
-
<li><code>license.js</code> introduces the <code>LicenseManager</code> class, which manages the licensing for all Dynamsoft SDKs.</li>
|
|
412
|
-
<li><code>utility.js</code> encompasses auxiliary classes shared among all Dynamsoft SDKs.</li>
|
|
413
|
-
<li><code>dbr.js</code> defines interfaces and enumerations tailored to the barcode reader module.</li>
|
|
414
|
-
<li><code>cvr.js</code> introduces the <code>CaptureVisionRouter</code> class, which governs the entire image processing workflow.</li>
|
|
415
|
-
<li><code>dce.js</code> comprises classes that offer camera support and basic user interface functionalities.</li>
|
|
416
|
-
</ul>
|
|
417
|
-
<p>To simplify things, starting from version 10.0.21, we introduced <code>dbr.bundle.js</code>, which combines all six of the above files. In the following chapters, we will use <code>dbr.bundle.js</code>.</p>
|
|
418
403
|
<h4 id="use-a-public-cdn">Use a public CDN</h4>
|
|
419
404
|
<p>The simplest way to include the SDK is to use either the <a href="https://jsdelivr.com/">jsDelivr</a> or <a href="https://unpkg.com/">UNPKG</a> CDN. The "hello world" example above uses <strong>jsDelivr</strong>.</p>
|
|
420
405
|
<ul>
|
|
@@ -434,7 +419,7 @@ cvRouter.addResultFilter(filter);
|
|
|
434
419
|
</code></pre>
|
|
435
420
|
<p>However, please <strong>DO NOT</strong> use <code>download2.dynamsoft.com</code> resources in a production application as they are for temporary testing purposes only. Instead, you can try hosting the SDK yourself.</p>
|
|
436
421
|
<ul>
|
|
437
|
-
<li>In frameworks like React and
|
|
422
|
+
<li>In frameworks like React, Vue and Angular, you may want to add the package as a dependency.</li>
|
|
438
423
|
</ul>
|
|
439
424
|
<pre><code class="hljs sh language-sh"> npm i dynamsoft-barcode-reader-bundle@10.4.2002 -E
|
|
440
425
|
<span class="hljs-comment"># or</span>
|
|
@@ -443,44 +428,33 @@ cvRouter.addResultFilter(filter);
|
|
|
443
428
|
<p>NOTE that in frameworks, you need to <a href="#specify-the-location-of-the-engine-files-optional">specify the engineResourcePaths</a>.</p>
|
|
444
429
|
<h4 id="host-the-sdk-yourself-optional">Host the SDK yourself (optional)</h4>
|
|
445
430
|
<p>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.</p>
|
|
446
|
-
<p>There are two options for downloading the SDK, and the usage for each is slightly different</p>
|
|
447
431
|
<ul>
|
|
448
432
|
<li><p>From the website</p>
|
|
449
433
|
<p><a href="https://www.dynamsoft.com/barcode-reader/downloads/?ver=10.4.20&utm_source=npm&product=dbr&package=js">Download Dynamsoft Barcode Reader JavaScript Package</a></p>
|
|
450
|
-
<p>The resources are located at path <code>dynamsoft/distributables/<pkg>@<version></code
|
|
451
|
-
</
|
|
452
|
-
<pre><code class="hljs html language-html"> <span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"dynamsoft/distributables/dynamsoft-barcode-reader-bundle@10.4.2002/dist/dbr.bundle.js"</span>></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span>
|
|
453
|
-
</code></pre>
|
|
454
|
-
<ul>
|
|
455
|
-
<li>npm</li>
|
|
434
|
+
<p>The resources are located at path <code>dynamsoft/distributables/<pkg>@<version></code>.</p></li>
|
|
435
|
+
<li><p>From npm</p></li>
|
|
456
436
|
</ul>
|
|
457
437
|
<pre><code class="hljs sh language-sh"> npm i dynamsoft-barcode-reader-bundle@10.4.2002 -E
|
|
458
438
|
<span class="hljs-comment"># Compared with using CDN, you need to set up more resources.</span>
|
|
459
439
|
npm i dynamsoft-capture-vision-std@1.4.10 -E
|
|
460
440
|
npm i dynamsoft-image-processing@2.4.20 -E
|
|
461
441
|
</code></pre>
|
|
462
|
-
<p>The resources are located at the path <code>node_modules/<pkg></code>, without <code>@<version></code
|
|
463
|
-
<
|
|
442
|
+
<p>The resources are located at the path <code>node_modules/<pkg></code>, without <code>@<version></code>. You need to copy "dynamsoft-xxx" packages elsewhere and add <code>@<version></code>. <code><version></code> can be get from <code>package.json</code> of each package.</p>
|
|
443
|
+
<p>You can typically include SDK like this:</p>
|
|
444
|
+
<pre><code class="hljs html language-html"><span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"path/to/dynamsoft-barcode-reader-bundle@10.4.2002/dist/dbr.bundle.js"</span>></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span>
|
|
464
445
|
</code></pre>
|
|
465
|
-
<p>Since the version tags (<code>@<version></code>) are missing, you need to <a href="#specify-the-location-of-the-engine-files-optional">specify the engineResourcePaths</a> so that the SDK can find the resources correctly.</p>
|
|
466
|
-
<blockquote>
|
|
467
|
-
<p>To avoid confusion, we suggest renaming "node<em>modules" or moving "dynamsoft-" packages elsewhere for self-hosting, as "node</em>modules" is reserved for Node.js dependencies.</p>
|
|
468
|
-
</blockquote>
|
|
469
446
|
<p><em>Note</em>:</p>
|
|
470
447
|
<ul>
|
|
471
448
|
<li>Certain legacy web application servers may lack support for the <code>application/wasm</code> mimetype for .wasm files. To address this, you have two options:</li>
|
|
472
449
|
</ul>
|
|
473
450
|
<ol>
|
|
474
451
|
<li>Upgrade your web application server to one that supports the <code>application/wasm</code> mimetype.</li>
|
|
475
|
-
<li>Manually define the mimetype on your server. You can refer to the
|
|
476
|
-
<li><a href="https://developer.mozilla.org/en-US/docs/Learn/Server-side/Apache_Configuration_htaccess#media_types_and_character_encodings">Apache</a></li>
|
|
477
|
-
<li><a href="https://docs.microsoft.com/en-us/iis/configuration/system.webserver/staticcontent/mimemap">IIS</a></li>
|
|
478
|
-
<li><a href="https://www.nginx.com/resources/wiki/start/topics/examples/full/#mime-types">Nginx</a></li></ol></li>
|
|
452
|
+
<li>Manually define the mimetype on your server. You can refer to the guides for <a href="https://developer.mozilla.org/en-US/docs/Learn/Server-side/Apache_Configuration_htaccess#media_types_and_character_encodings">apache</a> / <a href="https://docs.microsoft.com/en-us/iis/configuration/system.webserver/staticcontent/mimemap">IIS</a> / <a href="https://www.nginx.com/resources/wiki/start/topics/examples/full/#mime-types">nginx</a>.</li>
|
|
479
453
|
</ol>
|
|
480
454
|
<ul>
|
|
481
455
|
<li>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.</li>
|
|
482
456
|
</ul>
|
|
483
|
-
<pre><code class="hljs
|
|
457
|
+
<pre><code>hljs <span class="hljs-keyword">Cache</span><span class="hljs-params">-Control</span>: <span class="hljs-keyword">max</span><span class="hljs-params">-age</span>=<span class="hljs-number">31536000</span>
|
|
484
458
|
</code></pre>
|
|
485
459
|
<p>Reference: <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control">Cache-Control</a>.</p>
|
|
486
460
|
<h3 id="prepare-the-sdk">Prepare the SDK</h3>
|
|
@@ -494,11 +468,16 @@ cvRouter.addResultFilter(filter);
|
|
|
494
468
|
<p>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.</p>
|
|
495
469
|
</blockquote>
|
|
496
470
|
<h4 id="specify-the-location-of-the-engine-files-optional">Specify the location of the "engine" files (optional)</h4>
|
|
497
|
-
<p>This is usually only required with frameworks like Angular
|
|
498
|
-
<p>The purpose is to tell the SDK where to find the engine files (*.worker.js, *.wasm.js and *.wasm, etc.)
|
|
499
|
-
<pre><code class="hljs
|
|
471
|
+
<p>This is usually only required with frameworks like Angular, React or Vue.</p>
|
|
472
|
+
<p>The purpose is to tell the SDK where to find the engine files (*.worker.js, *.wasm.js and *.wasm, etc.).</p>
|
|
473
|
+
<pre><code class="hljs ts language-ts"><span class="hljs-comment">// in framework</span>
|
|
474
|
+
<span class="hljs-keyword">import</span> { CoreModule } <span class="hljs-keyword">from</span> <span class="hljs-string">"dynamsoft-barcode-reader-bundle"</span>;
|
|
500
475
|
CoreModule.engineResourcePaths.rootDirectory = <span class="hljs-string">"https://cdn.jsdelivr.net/npm/"</span>;
|
|
501
476
|
</code></pre>
|
|
477
|
+
<pre><code class="hljs js language-js"><span class="hljs-comment">// in pure js</span>
|
|
478
|
+
Dynamsoft.Core.CoreModule.engineResourcePaths.rootDirectory = <span class="hljs-string">"https://cdn.jsdelivr.net/npm/"</span>;
|
|
479
|
+
</code></pre>
|
|
480
|
+
<p>These code uses the jsDelivr CDN as an example, feel free to change it to your own location.</p>
|
|
502
481
|
<h3 id="set-up-and-start-image-processing">Set up and start image processing</h3>
|
|
503
482
|
<h4 id="preload-the-module">Preload the module</h4>
|
|
504
483
|
<p>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.</p>
|
|
@@ -542,11 +521,12 @@ CoreModule.engineResourcePaths.rootDirectory = <span class="hljs-string">"https:
|
|
|
542
521
|
cvRouter.setInput(cameraEnhancer);
|
|
543
522
|
</code></pre>
|
|
544
523
|
<h4 id="register-a-result-receiver">Register a result receiver</h4>
|
|
545
|
-
<p>Once the image processing is complete, the results are sent to all the registered <code>CapturedResultReceiver</code> objects. Each <code>CapturedResultReceiver</code> object may encompass one or multiple callback functions associated with various result types.
|
|
524
|
+
<p>Once the image processing is complete, the results are sent to all the registered <code>CapturedResultReceiver</code> objects. Each <code>CapturedResultReceiver</code> object may encompass one or multiple callback functions associated with various result types. This time we use <code>onCapturedResultReceived</code>:</p>
|
|
525
|
+
<!--In our particular case, our focus is on identifying barcodes within the images, so it's sufficient to define the callback function `onDecodedBarcodesReceived`:-->
|
|
546
526
|
<pre><code class="hljs javascript language-javascript"><span class="hljs-keyword">const</span> resultsContainer = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">"#results"</span>);
|
|
547
527
|
<span class="hljs-keyword">const</span> resultReceiver = <span class="hljs-keyword">new</span> Dynamsoft.CVR.CapturedResultReceiver();
|
|
548
|
-
resultReceiver.
|
|
549
|
-
<span class="hljs-keyword">if</span> (result.barcodeResultItems
|
|
528
|
+
resultReceiver.onCapturedResultReceived = <span class="hljs-function">(<span class="hljs-params">result</span>) =></span> {
|
|
529
|
+
<span class="hljs-keyword">if</span> (result.barcodeResultItems?.length) {
|
|
550
530
|
resultsContainer.textContent = <span class="hljs-string">''</span>;
|
|
551
531
|
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> item <span class="hljs-keyword">of</span> result.barcodeResultItems) {
|
|
552
532
|
<span class="hljs-comment">// In this example, the barcode results are displayed on the page below the video.</span>
|
|
@@ -558,8 +538,8 @@ cvRouter.addResultReceiver(resultReceiver);
|
|
|
558
538
|
</code></pre>
|
|
559
539
|
<p>You can also write code like this. It is the same.</p>
|
|
560
540
|
<pre><code class="hljs javascript language-javascript"><span class="hljs-keyword">const</span> resultsContainer = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">"#results"</span>);
|
|
561
|
-
cvRouter.addResultReceiver({ <span class="hljs-attr">
|
|
562
|
-
<span class="hljs-keyword">if</span> (result.barcodeResultItems
|
|
541
|
+
cvRouter.addResultReceiver({ <span class="hljs-attr">onCapturedResultReceived</span>: <span class="hljs-function">(<span class="hljs-params">result</span>) =></span> {
|
|
542
|
+
<span class="hljs-keyword">if</span> (result.barcodeResultItems?.length) {
|
|
563
543
|
resultsContainer.textContent = <span class="hljs-string">''</span>;
|
|
564
544
|
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> item <span class="hljs-keyword">of</span> result.barcodeResultItems) {
|
|
565
545
|
<span class="hljs-comment">// In this example, the barcode results are displayed on the page below the video.</span>
|
|
@@ -653,8 +633,7 @@ settings.capturedResultItemTypes =
|
|
|
653
633
|
<p>Please be aware that it is necessary to update the <code>CapturedResultReceiver</code> object to obtain the original image. For instance:</p>
|
|
654
634
|
<pre><code class="hljs javascript language-javascript"><span class="hljs-keyword">const</span> EnumCRIT = Dynamsoft.Core.EnumCapturedResultItemType;
|
|
655
635
|
resultReceiver.onCapturedResultReceived = <span class="hljs-function">(<span class="hljs-params">result</span>) =></span> {
|
|
656
|
-
<span class="hljs-keyword">
|
|
657
|
-
<span class="hljs-keyword">if</span> (barcodes.length > <span class="hljs-number">0</span>) {
|
|
636
|
+
<span class="hljs-keyword">if</span> (result.barcodeResultItems?.length) {
|
|
658
637
|
<span class="hljs-comment">// Use a filter to get the image on which barcodes are found.</span>
|
|
659
638
|
<span class="hljs-keyword">let</span> image = result.items.filter(
|
|
660
639
|
<span class="hljs-function"><span class="hljs-params">item</span> =></span> item.type === EnumCRIT.CRIT_ORIGINAL_IMAGE
|
|
@@ -775,58 +754,67 @@ resultReceiver.onDecodedBarcodesReceived = <span class="hljs-function">(<span cl
|
|
|
775
754
|
cvRouter.addResultReceiver(resultReceiver);
|
|
776
755
|
</code></pre>
|
|
777
756
|
<h3 id="customize-the-ui">Customize the UI</h3>
|
|
757
|
+
<pre><code class="hljs javascript language-javascript"><span class="hljs-comment">// Create a CameraView instance with default settings</span>
|
|
758
|
+
<span class="hljs-keyword">let</span> cameraView = <span class="hljs-keyword">await</span> Dynamsoft.DCE.CameraView.createInstance();
|
|
759
|
+
<span class="hljs-comment">// Create a CameraView instance with a specified HTML file path, typically a local or remote URL</span>
|
|
760
|
+
<span class="hljs-keyword">let</span> cameraView1 = <span class="hljs-keyword">await</span> Dynamsoft.DCE.CameraView.createInstance(<span class="hljs-string">'@engineResourcePath/dce.mobile-native.ui.html'</span>);
|
|
761
|
+
<span class="hljs-comment">// Create a CameraView instance within a specified DOM element</span>
|
|
762
|
+
<span class="hljs-keyword">let</span> cameraView2 = <span class="hljs-keyword">await</span> Dynamsoft.DCE.CameraView.createInstance(<span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'my-ui'</span>));
|
|
763
|
+
<span class="hljs-comment">// Create a CameraView instance using a custom UI file path</span>
|
|
764
|
+
<span class="hljs-keyword">let</span> cameraView3 = <span class="hljs-keyword">await</span> Dynamsoft.DCE.CameraView.createInstance(<span class="hljs-string">'url/to/my/ui.html'</span>);
|
|
765
|
+
|
|
766
|
+
<span class="hljs-comment">// Get the UI element associated with the cameraView instance</span>
|
|
767
|
+
<span class="hljs-keyword">let</span> uiElement = cameraView.getUIElement();
|
|
768
|
+
<span class="hljs-comment">// Remove the camera selection dropdown from the CameraView's UI element</span>
|
|
769
|
+
uiElement.shadowRoot.querySelector(<span class="hljs-string">'.dce-sel-camera'</span>).remove();
|
|
770
|
+
<span class="hljs-comment">// Remove the resolution selection dropdown from the CameraView's UI element</span>
|
|
771
|
+
uiElement.shadowRoot.querySelector(<span class="hljs-string">'.dce-sel-resolution'</span>).remove();
|
|
772
|
+
</code></pre>
|
|
778
773
|
<p>The UI is part of the auxiliary SDK "Dynamsoft Camera Enhancer", read more on how to <a href="https://www.dynamsoft.com/barcode-reader/docs/core/programming/features/ui-customization-js.html?lang=js">customize the UI</a>.</p>
|
|
779
774
|
<h2 id="api-documentation">API Documentation</h2>
|
|
780
775
|
<p>You can check out the detailed documentation about the APIs of the SDK at<br />
|
|
781
776
|
<a href="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</a>.</p>
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
</
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
<
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
<td style="text-align:center;">Safari</td>
|
|
824
|
-
<td style="text-align:center;">v14+</td>
|
|
825
|
-
</tr>
|
|
826
|
-
</tbody>
|
|
827
|
-
</table>
|
|
828
|
-
<p><sup>1</sup> devices running iOS needs to be on iOS 14.3+ for camera video streaming to work in Chrome, Firefox or other Apps using webviews.</p>
|
|
829
|
-
<p>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.</p>
|
|
777
|
+
<!-- Compatibility is basically not an issue. Pls remove to another place
|
|
778
|
+
|
|
779
|
+
## System Requirements
|
|
780
|
+
|
|
781
|
+
DBR requires the following features to work:
|
|
782
|
+
|
|
783
|
+
- Secure context (HTTPS deployment)
|
|
784
|
+
|
|
785
|
+
When deploying your application / website for production, make sure to serve it via a secure HTTPS connection. This is required for two reasons
|
|
786
|
+
|
|
787
|
+
- Access to the camera video stream is only granted in a security context. Most browsers impose this restriction.
|
|
788
|
+
> Some browsers like Chrome may grant the access for `http://127.0.0.1` and `http://localhost` or even for pages opened directly from the local disk (`file:///...`). This can be helpful for temporary development and test.
|
|
789
|
+
|
|
790
|
+
- Dynamsoft License requires a secure context to work.
|
|
791
|
+
|
|
792
|
+
- `WebAssembly`, `Blob`, `URL`/`createObjectURL`, `Web Workers`
|
|
793
|
+
|
|
794
|
+
The above four features are required for the SDK to work.
|
|
795
|
+
|
|
796
|
+
- `MediaDevices`/`getUserMedia`
|
|
797
|
+
|
|
798
|
+
This API is required for in-browser video streaming.
|
|
799
|
+
|
|
800
|
+
- `getSettings`
|
|
801
|
+
|
|
802
|
+
This API inspects the video input which is a `MediaStreamTrack` object about its constrainable properties.
|
|
803
|
+
|
|
804
|
+
The following table is a list of supported browsers based on the above requirements:
|
|
805
|
+
|
|
806
|
+
| Browser Name | Version |
|
|
807
|
+
| :----------: | :--------------: |
|
|
808
|
+
| Chrome | v78+<sup>1</sup> |
|
|
809
|
+
| Firefox | v68+<sup>1</sup> |
|
|
810
|
+
| Edge | v79+ |
|
|
811
|
+
| Safari | v14+ |
|
|
812
|
+
|
|
813
|
+
<sup>1</sup> devices running iOS needs to be on iOS 14.3+ for camera video streaming to work in Chrome, Firefox or other Apps using webviews.
|
|
814
|
+
|
|
815
|
+
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.
|
|
816
|
+
|
|
817
|
+
-->
|
|
830
818
|
<h2 id="how-to-upgrade">How to Upgrade</h2>
|
|
831
819
|
<p>If you want to upgrade the SDK from an old version to a newer one, please see <a href="https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/upgrade-guide/index.html?ver=10.4.2002&utm_source=npm">how to upgrade</a>.</p>
|
|
832
820
|
<h2 id="release-notes">Release Notes</h2>
|
package/README.md
CHANGED
|
@@ -47,7 +47,6 @@ In this guide, you will learn step by step on how to integrate the DBR-JS SDK in
|
|
|
47
47
|
- [Add feedback](#add-feedback)
|
|
48
48
|
- [Customize the UI](#customize-the-ui)
|
|
49
49
|
- [API Documentation](#api-documentation)
|
|
50
|
-
- [System Requirements](#system-requirements)
|
|
51
50
|
- [How to Upgrade](#how-to-upgrade)
|
|
52
51
|
- [Release Notes](#release-notes)
|
|
53
52
|
- [Next Steps](#next-steps)
|
|
@@ -58,11 +57,11 @@ In this guide, you will learn step by step on how to integrate the DBR-JS SDK in
|
|
|
58
57
|
- Angular App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/angular)
|
|
59
58
|
- React App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/react)
|
|
60
59
|
- 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)
|
|
60
|
+
- PWA App - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/hello-world/pwa) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/pwa/helloworld-pwa.html?ver=10.4.20&utm_source=npm)
|
|
62
61
|
- 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)
|
|
62
|
+
- Read Driver Licenses - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/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.20&utm_source=npm)
|
|
63
|
+
- 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) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/use-case/fill-a-form-with-barcode-reading.html?ver=10.4.20&utm_source=npm)
|
|
64
|
+
- 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) \| [Run](https://demo.dynamsoft.com/Samples/DBR/JS/use-case/show-result-texts-on-the-video.html?ver=10.4.20&utm_source=npm)
|
|
66
65
|
- Debug Camera and Collect Video Frame - [Github](https://github.com/Dynamsoft/barcode-reader-javascript-samples/blob/v10.4.20/others/debug)
|
|
67
66
|
|
|
68
67
|
You can also:
|
|
@@ -102,8 +101,8 @@ The complete code of the "Hello World" example is shown below
|
|
|
102
101
|
cvRouter.setInput(cameraEnhancer);
|
|
103
102
|
|
|
104
103
|
const resultsContainer = document.querySelector("#results");
|
|
105
|
-
cvRouter.addResultReceiver({
|
|
106
|
-
if (result.barcodeResultItems
|
|
104
|
+
cvRouter.addResultReceiver({ onCapturedResultReceived: (result) => {
|
|
105
|
+
if (result.barcodeResultItems?.length) {
|
|
107
106
|
resultsContainer.textContent = '';
|
|
108
107
|
for (let item of result.barcodeResultItems) {
|
|
109
108
|
resultsContainer.textContent += `${item.formatString}: ${item.text}\n\n`;
|
|
@@ -190,34 +189,18 @@ When a barcode is decoded, you will see the result text show up under the video
|
|
|
190
189
|
|
|
191
190
|
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
191
|
|
|
193
|
-
*
|
|
194
|
-
|
|
195
|
-
If you open the web page as `
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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).
|
|
192
|
+
> *Secure Contexts*:
|
|
193
|
+
>
|
|
194
|
+
> 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.
|
|
195
|
+
>
|
|
196
|
+
> 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.
|
|
197
|
+
>
|
|
198
|
+
> 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).
|
|
205
199
|
|
|
206
200
|
## Building your own page
|
|
207
201
|
|
|
208
202
|
### Include the SDK
|
|
209
203
|
|
|
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
204
|
#### Use a public CDN
|
|
222
205
|
|
|
223
206
|
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**.
|
|
@@ -242,7 +225,7 @@ The simplest way to include the SDK is to use either the [jsDelivr](https://jsde
|
|
|
242
225
|
|
|
243
226
|
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
227
|
|
|
245
|
-
- In frameworks like React and
|
|
228
|
+
- In frameworks like React, Vue and Angular, you may want to add the package as a dependency.
|
|
246
229
|
|
|
247
230
|
```sh
|
|
248
231
|
npm i dynamsoft-barcode-reader-bundle@10.4.2002 -E
|
|
@@ -256,19 +239,13 @@ The simplest way to include the SDK is to use either the [jsDelivr](https://jsde
|
|
|
256
239
|
|
|
257
240
|
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
241
|
|
|
259
|
-
There are two options for downloading the SDK, and the usage for each is slightly different
|
|
260
|
-
|
|
261
242
|
- From the website
|
|
262
243
|
|
|
263
244
|
[Download Dynamsoft Barcode Reader JavaScript Package](https://www.dynamsoft.com/barcode-reader/downloads/?ver=10.4.20&utm_source=npm&product=dbr&package=js)
|
|
264
245
|
|
|
265
|
-
The resources are located at path `dynamsoft/distributables/<pkg>@<version
|
|
266
|
-
|
|
267
|
-
```html
|
|
268
|
-
<script src="dynamsoft/distributables/dynamsoft-barcode-reader-bundle@10.4.2002/dist/dbr.bundle.js"></script>
|
|
269
|
-
```
|
|
246
|
+
The resources are located at path `dynamsoft/distributables/<pkg>@<version>`.
|
|
270
247
|
|
|
271
|
-
- npm
|
|
248
|
+
- From npm
|
|
272
249
|
|
|
273
250
|
```sh
|
|
274
251
|
npm i dynamsoft-barcode-reader-bundle@10.4.2002 -E
|
|
@@ -277,28 +254,23 @@ There are two options for downloading the SDK, and the usage for each is slightl
|
|
|
277
254
|
npm i dynamsoft-image-processing@2.4.20 -E
|
|
278
255
|
```
|
|
279
256
|
|
|
280
|
-
The resources are located at the path `node_modules/<pkg>`, without `@<version
|
|
281
|
-
|
|
282
|
-
```html
|
|
283
|
-
<script src="node_modules/dynamsoft-barcode-reader-bundle/dist/dbr.bundle.js"></script>
|
|
284
|
-
```
|
|
257
|
+
The resources are located at the path `node_modules/<pkg>`, without `@<version>`. You need to copy "dynamsoft-xxx" packages elsewhere and add `@<version>`. `<version>` can be get from `package.json` of each package.
|
|
285
258
|
|
|
286
|
-
|
|
259
|
+
You can typically include SDK like this:
|
|
287
260
|
|
|
288
|
-
|
|
261
|
+
```html
|
|
262
|
+
<script src="path/to/dynamsoft-barcode-reader-bundle@10.4.2002/dist/dbr.bundle.js"></script>
|
|
263
|
+
```
|
|
289
264
|
|
|
290
265
|
*Note*:
|
|
291
266
|
|
|
292
267
|
* Certain legacy web application servers may lack support for the `application/wasm` mimetype for .wasm files. To address this, you have two options:
|
|
293
268
|
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
|
|
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)
|
|
269
|
+
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
270
|
|
|
299
271
|
* 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
272
|
|
|
301
|
-
```
|
|
273
|
+
```
|
|
302
274
|
Cache-Control: max-age=31536000
|
|
303
275
|
```
|
|
304
276
|
|
|
@@ -322,14 +294,20 @@ As previously stated, the key "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" serves
|
|
|
322
294
|
|
|
323
295
|
#### Specify the location of the "engine" files (optional)
|
|
324
296
|
|
|
325
|
-
This is usually only required with frameworks like Angular
|
|
297
|
+
This is usually only required with frameworks like Angular, React or Vue.
|
|
326
298
|
|
|
327
|
-
The purpose is to tell the SDK where to find the engine files (\*.worker.js, \*.wasm.js and \*.wasm, etc.).
|
|
299
|
+
The purpose is to tell the SDK where to find the engine files (\*.worker.js, \*.wasm.js and \*.wasm, etc.).
|
|
328
300
|
|
|
329
|
-
```
|
|
330
|
-
//
|
|
301
|
+
```ts
|
|
302
|
+
// in framework
|
|
303
|
+
import { CoreModule } from "dynamsoft-barcode-reader-bundle";
|
|
331
304
|
CoreModule.engineResourcePaths.rootDirectory = "https://cdn.jsdelivr.net/npm/";
|
|
332
305
|
```
|
|
306
|
+
```js
|
|
307
|
+
// in pure js
|
|
308
|
+
Dynamsoft.Core.CoreModule.engineResourcePaths.rootDirectory = "https://cdn.jsdelivr.net/npm/";
|
|
309
|
+
```
|
|
310
|
+
These code uses the jsDelivr CDN as an example, feel free to change it to your own location.
|
|
333
311
|
|
|
334
312
|
### Set up and start image processing
|
|
335
313
|
|
|
@@ -395,13 +373,14 @@ cvRouter.setInput(cameraEnhancer);
|
|
|
395
373
|
|
|
396
374
|
#### Register a result receiver
|
|
397
375
|
|
|
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.
|
|
376
|
+
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`:
|
|
377
|
+
<!--In our particular case, our focus is on identifying barcodes within the images, so it's sufficient to define the callback function `onDecodedBarcodesReceived`:-->
|
|
399
378
|
|
|
400
379
|
```javascript
|
|
401
380
|
const resultsContainer = document.querySelector("#results");
|
|
402
381
|
const resultReceiver = new Dynamsoft.CVR.CapturedResultReceiver();
|
|
403
|
-
resultReceiver.
|
|
404
|
-
if (result.barcodeResultItems
|
|
382
|
+
resultReceiver.onCapturedResultReceived = (result) => {
|
|
383
|
+
if (result.barcodeResultItems?.length) {
|
|
405
384
|
resultsContainer.textContent = '';
|
|
406
385
|
for (let item of result.barcodeResultItems) {
|
|
407
386
|
// In this example, the barcode results are displayed on the page below the video.
|
|
@@ -416,8 +395,8 @@ You can also write code like this. It is the same.
|
|
|
416
395
|
|
|
417
396
|
```javascript
|
|
418
397
|
const resultsContainer = document.querySelector("#results");
|
|
419
|
-
cvRouter.addResultReceiver({
|
|
420
|
-
if (result.barcodeResultItems
|
|
398
|
+
cvRouter.addResultReceiver({ onCapturedResultReceived: (result) => {
|
|
399
|
+
if (result.barcodeResultItems?.length) {
|
|
421
400
|
resultsContainer.textContent = '';
|
|
422
401
|
for (let item of result.barcodeResultItems) {
|
|
423
402
|
// In this example, the barcode results are displayed on the page below the video.
|
|
@@ -506,8 +485,7 @@ Please be aware that it is necessary to update the `CapturedResultReceiver` obje
|
|
|
506
485
|
```javascript
|
|
507
486
|
const EnumCRIT = Dynamsoft.Core.EnumCapturedResultItemType;
|
|
508
487
|
resultReceiver.onCapturedResultReceived = (result) => {
|
|
509
|
-
|
|
510
|
-
if (barcodes.length > 0) {
|
|
488
|
+
if (result.barcodeResultItems?.length) {
|
|
511
489
|
// Use a filter to get the image on which barcodes are found.
|
|
512
490
|
let image = result.items.filter(
|
|
513
491
|
item => item.type === EnumCRIT.CRIT_ORIGINAL_IMAGE
|
|
@@ -669,6 +647,24 @@ cvRouter.addResultReceiver(resultReceiver);
|
|
|
669
647
|
|
|
670
648
|
### Customize the UI
|
|
671
649
|
|
|
650
|
+
```javascript
|
|
651
|
+
// Create a CameraView instance with default settings
|
|
652
|
+
let cameraView = await Dynamsoft.DCE.CameraView.createInstance();
|
|
653
|
+
// Create a CameraView instance with a specified HTML file path, typically a local or remote URL
|
|
654
|
+
let cameraView1 = await Dynamsoft.DCE.CameraView.createInstance('@engineResourcePath/dce.mobile-native.ui.html');
|
|
655
|
+
// Create a CameraView instance within a specified DOM element
|
|
656
|
+
let cameraView2 = await Dynamsoft.DCE.CameraView.createInstance(document.getElementById('my-ui'));
|
|
657
|
+
// Create a CameraView instance using a custom UI file path
|
|
658
|
+
let cameraView3 = await Dynamsoft.DCE.CameraView.createInstance('url/to/my/ui.html');
|
|
659
|
+
|
|
660
|
+
// Get the UI element associated with the cameraView instance
|
|
661
|
+
let uiElement = cameraView.getUIElement();
|
|
662
|
+
// Remove the camera selection dropdown from the CameraView's UI element
|
|
663
|
+
uiElement.shadowRoot.querySelector('.dce-sel-camera').remove();
|
|
664
|
+
// Remove the resolution selection dropdown from the CameraView's UI element
|
|
665
|
+
uiElement.shadowRoot.querySelector('.dce-sel-resolution').remove();
|
|
666
|
+
```
|
|
667
|
+
|
|
672
668
|
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
669
|
|
|
674
670
|
## API Documentation
|
|
@@ -676,6 +672,8 @@ The UI is part of the auxiliary SDK "Dynamsoft Camera Enhancer", read more on ho
|
|
|
676
672
|
You can check out the detailed documentation about the APIs of the SDK at
|
|
677
673
|
[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).
|
|
678
674
|
|
|
675
|
+
<!-- Compatibility is basically not an issue. Pls remove to another place
|
|
676
|
+
|
|
679
677
|
## System Requirements
|
|
680
678
|
|
|
681
679
|
DBR requires the following features to work:
|
|
@@ -714,6 +712,8 @@ The following table is a list of supported browsers based on the above requireme
|
|
|
714
712
|
|
|
715
713
|
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
714
|
|
|
715
|
+
-->
|
|
716
|
+
|
|
717
717
|
## How to Upgrade
|
|
718
718
|
|
|
719
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).
|