Skip to content

Commit 9dc4797

Browse files
committed
2 parents dde22f4 + db7d134 commit 9dc4797

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+136
-67
lines changed

1.hello-world/1.hello-world.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<body>
1414
Loading...
15-
<script src="https://cdn.jsdelivr.net/npm/[email protected].11/dist/dbr.js"></script>
15+
<script src="https://cdn.jsdelivr.net/npm/[email protected].20/dist/dbr.js"></script>
1616
<script>
1717
if(location.protocol === "file:") {
1818
const message = `The page is opened via file:// and "BarcodeScanner" may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
@@ -30,7 +30,7 @@
3030
/**
3131
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
3232
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
33-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.11&utm_source=github#specify-the-license or contact [email protected].
33+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.20&utm_source=github#specify-the-license or contact [email protected].
3434
* LICENSE ALERT - THE END
3535
*/
3636

1.hello-world/10.read-video-pwa/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ First, create a file with the name "helloworld-pwa.html" and fill it with the fo
2626
<body>
2727
<h1 style="font-size: 1.5em;">Hello World for PWA</h1>
2828
Loading...
29-
<script src="https://cdn.jsdelivr.net/npm/[email protected].10/dist/dbr.js"></script>
29+
<script src="https://cdn.jsdelivr.net/npm/[email protected].20/dist/dbr.js"></script>
3030
<script>
3131
Dynamsoft.DBR.BarcodeReader.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
3232
(async function() {
@@ -184,7 +184,7 @@ For offline use, you need to cache more files.
184184

185185
service-worker.js
186186
```javascript
187-
const dbrVersion = "9.6.11";
187+
const dbrVersion = "9.6.20";
188188
const dbrCdn = `https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@${dbrVersion}/dist/`;
189189

190190
const appShellFiles = [

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<body>
2222
<h1 style="font-size: 1.5em;">Hello World for PWA</h1>
2323
Loading...
24-
<script src="https://cdn.jsdelivr.net/npm/[email protected].11/dist/dbr.js"></script>
24+
<script src="https://cdn.jsdelivr.net/npm/[email protected].20/dist/dbr.js"></script>
2525
<script>
2626
if(location.protocol === "file:") {
2727
const message = `The page is opened via file:// and "BarcodeScanner" may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
@@ -39,7 +39,7 @@ <h1 style="font-size: 1.5em;">Hello World for PWA</h1>
3939
/**
4040
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
4141
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
42-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.11&utm_source=github#specify-the-license or contact [email protected].
42+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.20&utm_source=github#specify-the-license or contact [email protected].
4343
* LICENSE ALERT - THE END
4444
*/
4545

1.hello-world/10.read-video-pwa/service-worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const dbrVersion = "9.6.11";
1+
const dbrVersion = "9.6.20";
22
const dbrCdn = `https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@${dbrVersion}/dist/`;
33

44
// Files to cache

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
2020
}
2121
</script>
2222
<script>
23-
requirejs(['https://cdn.jsdelivr.net/npm/[email protected].11/dist/dbr.js'], function({
23+
requirejs(['https://cdn.jsdelivr.net/npm/[email protected].20/dist/dbr.js'], function({
2424
BarcodeReader,
2525
BarcodeScanner
2626
}) {
@@ -33,11 +33,11 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
3333
/**
3434
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
3535
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
36-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.11&utm_source=github#specify-the-license or contact [email protected].
36+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.20&utm_source=github#specify-the-license or contact [email protected].
3737
* LICENSE ALERT - THE END
3838
*/
3939

40-
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/[email protected].11/dist/";
40+
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/[email protected].20/dist/";
4141
(async function() {
4242
try {
4343
const scanner = await BarcodeScanner.createInstance();

1.hello-world/12.read-video-es6.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h1 style="font-size: 1.5em;">Hello World for ES6</h1>
2020
}
2121
</script>
2222
<script type="module">
23-
import { BarcodeReader, BarcodeScanner } from 'https://cdn.jsdelivr.net/npm/[email protected].11/dist/dbr.mjs';
23+
import { BarcodeReader, BarcodeScanner } from 'https://cdn.jsdelivr.net/npm/[email protected].20/dist/dbr.mjs';
2424
/** LICENSE ALERT - README
2525
* To use the library, you need to first specify a license key using the API "license" as shown below.
2626
*/
@@ -30,11 +30,11 @@ <h1 style="font-size: 1.5em;">Hello World for ES6</h1>
3030
/**
3131
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
3232
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
33-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.11&utm_source=github#specify-the-license or contact [email protected].
33+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.20&utm_source=github#specify-the-license or contact [email protected].
3434
* LICENSE ALERT - THE END
3535
*/
3636

37-
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/[email protected].11/dist/";
37+
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/[email protected].20/dist/";
3838

3939
(async () => {
4040
try {

1.hello-world/13.read-video-react-hooks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@types/node": "^16.18.12",
1212
"@types/react": "^18.0.27",
1313
"@types/react-dom": "^18.0.10",
14-
"dynamsoft-javascript-barcode": "9.6.11",
14+
"dynamsoft-javascript-barcode": "9.6.20",
1515
"react": "^18.2.0",
1616
"react-dom": "^18.2.0",
1717
"react-scripts": "5.0.1",

1.hello-world/13.read-video-react-hooks/src/dbr.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ BarcodeReader.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
99
/**
1010
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
1111
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
12-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.11&utm_source=github#specify-the-license or contact [email protected].
12+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.20&utm_source=github#specify-the-license or contact [email protected].
1313
* LICENSE ALERT - THE END
1414
*/
1515

16-
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/[email protected].11/dist/";
16+
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/[email protected].20/dist/";

1.hello-world/14.read-video-webview/android/app/src/main/assets/decodeBarcodeInVideo.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<body>
1414
Loading...
15-
<script src="https://cdn.jsdelivr.net/npm/[email protected].11/dist/dbr.js"></script>
15+
<script src="https://cdn.jsdelivr.net/npm/[email protected].20/dist/dbr.js"></script>
1616
<script>
1717
/** LICENSE ALERT - README
1818
* To use the library, you need to first specify a license key using the API "license" as shown below.
@@ -23,7 +23,7 @@
2323
/**
2424
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
2525
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
26-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.11&utm_source=github#specify-the-license or contact [email protected].
26+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.20&utm_source=github#specify-the-license or contact [email protected].
2727
* LICENSE ALERT - THE END
2828
*/
2929

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<meta name="description" content="Quickly read barcodes with Dynamsoft Barcode Reader from a live camera stream.">
8+
<meta name="keywords" content="camera based barcode reading">
9+
<link rel="canonical" href="https://demo.dynamsoft.com/Samples/DBR/JS/1.hello-world/14.read-video-webview">
10+
<title>Dynamsoft Barcode Reader Sample - Read Video WKWebView(iOS)</title>
11+
</head>
12+
13+
<body style="margin: 0;padding: 0;">
14+
<div id="UIElement" style="width: 100vw;height: 100vh;">
15+
<span id='lib-load' style='font-size:x-large' hidden>Loading Library...</span>
16+
<div id="div-ui-container" class="div-ui-container">
17+
<div class="dce-video-container"></div>
18+
</div>
19+
</div>
20+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dbr.js"></script>
21+
<script>
22+
/** LICENSE ALERT - README
23+
* To use the library, you need to first specify a license key using the API "license" as shown below.
24+
*/
25+
26+
Dynamsoft.DBR.BarcodeReader.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
27+
28+
/**
29+
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
30+
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
31+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.20&utm_source=github#specify-the-license or contact [email protected].
32+
* LICENSE ALERT - THE END
33+
*/
34+
35+
let pScanner = null;
36+
(async function () {
37+
try {
38+
await Dynamsoft.DBR.BarcodeReader.loadWasm();
39+
window.webkit.messageHandlers.onWasmLoaded.postMessage("");
40+
} catch (ex) {
41+
let errMsg;
42+
if (ex.message.includes("network connection error")) {
43+
errMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support ([email protected]) to acquire an offline license.";
44+
} else {
45+
errMsg = ex.message || ex;
46+
}
47+
console.error(errMsg);
48+
alert(errMsg);
49+
}
50+
})();
51+
52+
async function startScanner() {
53+
let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
54+
await scanner.setUIElement(document.getElementById('div-ui-container'));
55+
scanner.onUniqueRead = (txt, result) => {
56+
const format = result.barcodeFormatString;
57+
window.webkit.messageHandlers.onUniqueRead.postMessage(format + " " + txt);
58+
};
59+
await scanner.show();
60+
}
61+
62+
async function stopScanner() {
63+
let scanner = await pScanner;
64+
scanner && scanner.hide();
65+
}
66+
</script>
67+
</body>
68+
69+
</html>

0 commit comments

Comments
 (0)