Skip to content

Commit 77ec044

Browse files
committed
update code to adapt to DBR JS 9.0.0
1 parent 550dbab commit 77ec044

9 files changed

Lines changed: 27 additions & 30 deletions

1.hello-world/10.read-video-pwa/helloworld-pwa.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ <h1 style="font-size: 1.5em;">Hello World for PWA</h1>
4545
console.log(result.barcodeFormatString + ": " + result.barcodeText);
4646
}
4747
};
48-
scanner.onUnduplicatedRead = (txt, result) => {
48+
scanner.onUniqueRead = (txt, result) => {
4949
latestResult = txt;
5050
alert(txt, result);
5151
}

1.hello-world/11.read-video-requirejs.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
1313
<button id="readBarcode">show scanner</button>
1414
<script src="https://cdn.jsdelivr.net/npm/requirejs@2.3.6/require.js"></script>
1515
<script>
16-
requirejs(['https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/dbr.js'], function({
16+
requirejs(['https://cdn.jsdelivr.net/npm/keillion-dynamsoft-javascript-barcode@0.20220318174621.0/dist/dbr.js'], function({
1717
BarcodeReader,
1818
BarcodeScanner
1919
}) {
@@ -31,7 +31,7 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
3131

3232
/** LICENSE ALERT - THE END */
3333

34-
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/";
34+
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/keillion-dynamsoft-javascript-barcode@0.20220318174621.0/dist/";
3535
let pScanner = null;
3636
document.getElementById('readBarcode').onclick = async function() {
3737
try {
@@ -42,7 +42,7 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
4242
console.log(result.barcodeFormatString + ": " + result.barcodeText);
4343
}
4444
};
45-
scanner.onUnduplicatedRead = (txt, result) => {
45+
scanner.onUniqueRead = (txt, result) => {
4646
alert(txt);
4747
console.log("Unique Code Found: ", result);
4848
}

1.hello-world/12.read-video-webpack/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (document.getElementById('readBarcode')) {
2727
console.log(result.barcodeFormatString + ": " + result.barcodeText);
2828
}
2929
};
30-
scanner.onUnduplicatedRead = (txt, result) => {
30+
scanner.onUniqueRead = (txt, result) => {
3131
alert(txt);
3232
console.log("Unique Code Found: ", result);
3333
}

1.hello-world/13.minimum-code-es6.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ <h1 style="font-size: 1.5em;">Read Barcodes from a Camera</h1>
5151
* The amount of time that the library 'remembers' a barcode is defined by
5252
* "duplicateForgetTime" in "ScanSettings". By default it is set to 3000 ms.
5353
*/
54-
scanner.onUnduplicatedRead = (txt, result) => {
54+
scanner.onUniqueRead = (txt, result) => {
5555
alert(txt);
5656
console.log("Unique Code Found: ", result);
5757
}

2.ui-tweaking/1.read-video-show-result.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h1 style="font-size: 1.5em;">Use the Default Built-in UI</h1>
1515
<div id="UIElement">
1616
<button id="showScanner">Show The Scanner</button>
1717
</div>
18-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/dbr.js"></script>
18+
<script src="https://cdn.jsdelivr.net/npm/keillion-dynamsoft-javascript-barcode@0.20220318174621.0/dist/dbr.js"></script>
1919
<script>
2020
/** LICENSE ALERT - README
2121
*
@@ -45,7 +45,7 @@ <h1 style="font-size: 1.5em;">Use the Default Built-in UI</h1>
4545
document.getElementById('showScanner').addEventListener('click', async () => {
4646
try {
4747
let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
48-
scanner.onUnduplicatedRead = (txt, result) => { alert(txt); };
48+
scanner.onUniqueRead = (txt, result) => { alert(txt); };
4949
document.getElementById('UIElement').appendChild(scanner.getUIElement());
5050
await scanner.show();
5151
} catch (ex) {

2.ui-tweaking/2.read-video-no-extra-control.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
<body>
1313
<h1 style="font-size: 1.5em;">Hide UI Controllers</h1>
1414
<div id="UIElement">
15-
<div id="div-video-container" style="width:100%;height:100%;">
16-
<video class="dce-video" playsinline="true" muted style="width:100%;height:100%;"></video>
15+
<div id="div-ui-container" style="width:100%;height:100%;">
16+
<div class="dce-video-container" style="position:relative;width:100%;height:100%;"></div>
1717
</div>
1818
</div>
19-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/dbr.js"></script>
19+
<script src="https://cdn.jsdelivr.net/npm/keillion-dynamsoft-javascript-barcode@0.20220318174621.0/dist/dbr.js"></script>
2020
<script>
2121
/** LICENSE ALERT - README
2222
*
@@ -39,8 +39,8 @@ <h1 style="font-size: 1.5em;">Hide UI Controllers</h1>
3939
(async () => {
4040
try {
4141
let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
42-
await scanner.setUIElement(document.getElementById('div-video-container'));
43-
scanner.onUnduplicatedRead = (txt, result) => { alert(text); };
42+
await scanner.setUIElement(document.getElementById('div-ui-container'));
43+
scanner.onUniqueRead = (txt, result) => { alert(text); };
4444
await scanner.open();
4545
} catch (ex) {
4646
alert(ex.message);
@@ -80,7 +80,7 @@ <h1 style="font-size: 1.5em;">Hide UI Controllers</h1>
8080
width: 100vw;
8181
}
8282

83-
.div-video-container {
83+
.div-ui-container {
8484
width: 100%;
8585
height: 100%;
8686
}

2.ui-tweaking/3.read-video-with-external-control.html

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,15 @@ <h1 style="font-size: 1.5em;">Customized UI</h1>
5858
<div id="UIElement">
5959
<div id="div-video-container"
6060
style="width:100%;height:100%;min-width:100px;min-height:100px;position:relative;">
61-
<video class="dce-video" playsinline="true" muted
62-
style="width:100%;height:100%;position:absolute;left:0;top:0;"></video>
63-
<canvas class="dbrScanner-cvs-drawarea"
64-
style="width:100%;height:100%;position:absolute;left:0;top:0;"></canvas>
65-
<div class="dbrScanner-cvs-scanarea" style="width:100%;height:100%;position:absolute;left:0;top:0;">
66-
<div class="dbrScanner-scanlight"
67-
style="display:none;width:100%;height:3%;position:absolute;animation:3s infinite dbrScanner-scanlight;border-radius:50%;box-shadow:0px 0px 2vw 1px #00e5ff;background:#fff;user-select:none;">
61+
<div class="dce-video-container" style="position:absolute;left:0;top:0;width:100%;height:100%;"></div>
62+
<div class="dce-scanarea" style="width:100%;height:100%;position:absolute;left:0;top:0;">
63+
<div class="dce-scanlight"
64+
style="display:none;width:100%;height:3%;position:absolute;animation:3s infinite dce-scanlight;border-radius:50%;box-shadow:0px 0px 2vw 1px #00e5ff;background:#fff;user-select:none;">
6865
</div>
6966
</div>
7067
</div>
7168
</div>
72-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/dbr.js"></script>
69+
<script src="https://cdn.jsdelivr.net/npm/keillion-dynamsoft-javascript-barcode@0.20220318174621.0/dist/dbr.js"></script>
7370
<script>
7471
/** LICENSE ALERT - README
7572
*
@@ -120,7 +117,7 @@ <h1 style="font-size: 1.5em;">Customized UI</h1>
120117
}
121118
};
122119
document.getElementById('toggleScanLight').onclick = function () {
123-
let scanlight = document.getElementsByClassName('dbrScanner-scanlight');
120+
let scanlight = document.getElementsByClassName('dce-scanlight');
124121
if (scanlight.length) {
125122
scanlight[0].hidden = !this.checked;
126123
}

2.ui-tweaking/4.difference-video-size.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ <h1 style="font-size: 1.5em;">Enlarge the Video Stream</h1>
1616
<button id="fitPage">Enter Full Screen, Read and Exit</button>
1717
</div>
1818
<div id="UIElement" class="UIElement">
19-
<div id="div-video-container" style="width:100%;height:100%;">
20-
<video class="dce-video" playsinline="true" muted style="width:100%;height:100%;"></video>
19+
<div id="div-ui-container" style="width:100%;height:100%;">
20+
<div class="dce-video-container" style="position:relative;width:100%;height:100%;"></div>
2121
</div>
2222
</div>
23-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/dbr.js"></script>
23+
<script src="https://cdn.jsdelivr.net/npm/keillion-dynamsoft-javascript-barcode@0.20220318174621.0/dist/dbr.js"></script>
2424
<script>
2525
/** LICENSE ALERT - README
2626
*
@@ -69,8 +69,8 @@ <h1 style="font-size: 1.5em;">Enlarge the Video Stream</h1>
6969
async function showScanner() {
7070
try {
7171
let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
72-
await scanner.setUIElement(document.getElementById('div-video-container'));
73-
scanner.onUnduplicatedRead = (txt, result) => { alert(txt); };
72+
await scanner.setUIElement(document.getElementById('div-ui-container'));
73+
scanner.onUniqueRead = (txt, result) => { alert(txt); };
7474
await scanner.show();
7575
} catch (ex) {
7676
alert(ex.message);

2.ui-tweaking/5.read-video-with-custom-default-ui.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ <h1 style="font-size: 1.5em;">Customized UI</h1>
4444
</div>
4545
<div id="UIElement">
4646
</div>
47-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/dbr.js"></script>
47+
<script src="https://cdn.jsdelivr.net/npm/keillion-dynamsoft-javascript-barcode@0.20220318174621.0/dist/dbr.js"></script>
4848
<script>
4949
/** LICENSE ALERT - README
5050
*
@@ -103,7 +103,7 @@ <h1 style="font-size: 1.5em;">Customized UI</h1>
103103
// when the last two values are judged to be false, it means this is the first time into the function showScanner
104104
if (!currentResolution && !currentCamera) {
105105
document.getElementById('UIElement').appendChild(scanner.getUIElement());
106-
scanner.onUnduplicatedRead = (txt, result) => { alert(txt); };
106+
scanner.onUniqueRead = (txt, result) => { alert(txt); };
107107
await scanner.open();
108108
cameras = await scanner.getAllCameras();
109109
}

0 commit comments

Comments
 (0)