Skip to content

Commit

Permalink
Merge pull request #221 from Dynamsoft/_dev
Browse files Browse the repository at this point in the history
UPDATE
  • Loading branch information
Shen-wb authored Oct 25, 2024
2 parents 83351aa + 5b707bf commit ed1dab0
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 13 deletions.
3 changes: 3 additions & 0 deletions hello-world/angular/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,8 @@
}
}
}
},
"cli": {
"analytics": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export class VideoCaptureComponent {

// Open camera and start scanning single barcode.
await this.cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
if (this.isDestroyed) {
throw Error(componentDestroyedErrorMsg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ window.startVideoDecode = async () => {

// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
await cvRouter.startCapturing("ReadSingleBarcode");
} catch (ex) {
let errMsg = ex.message || ex;
Expand Down
1 change: 1 addition & 0 deletions hello-world/electron/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Dynamsoft.Core.CoreModule.loadWasm(["DBR"]);

// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
await cvRouter.startCapturing("ReadSingleBarcode");
} catch (ex) {
let errMsg = ex.message || ex;
Expand Down
1 change: 1 addition & 0 deletions hello-world/es6.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ <h1>Hello World for ES6 (Decode via Camera)</h1>

// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
await cvRouter.startCapturing("ReadSingleBarcode");
} catch (ex) {
let errMsg = ex.message || ex;
Expand Down
1 change: 1 addition & 0 deletions hello-world/hello-world.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ <h1>Hello World (Decode via Camera)</h1>

// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
await cvRouter.startCapturing("ReadSingleBarcode");
} catch (ex) {
let errMsg = ex.message || ex;
Expand Down
1 change: 1 addition & 0 deletions hello-world/native-ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ let cvRouter: CaptureVisionRouter;

// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
await cvRouter.startCapturing("ReadSingleBarcode");
} catch (ex: any) {
let errMsg = ex.message || ex;
Expand Down
1 change: 1 addition & 0 deletions hello-world/next/components/VideoCapture/VideoCapture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function VideoCapture() {

// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
if (isDestroyed) {
throw Error(componentDestroyedErrorMsg);
}
Expand Down
1 change: 1 addition & 0 deletions hello-world/nuxt/components/VideoCapture.client.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ onMounted(async () => {
// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
if (isDestroyed) { throw Error(componentDestroyedErrorMsg); }
await cvRouter.startCapturing("ReadSingleBarcode");
if (isDestroyed) { throw Error(componentDestroyedErrorMsg); }
Expand Down
1 change: 1 addition & 0 deletions hello-world/pwa/helloworld-pwa.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ <h1>Hello World for PWA</h1>

// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
await cvRouter.startCapturing("ReadSingleBarcode");
} catch (ex) {
let errMsg = ex.message || ex;
Expand Down
8 changes: 4 additions & 4 deletions hello-world/pwa/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const engineResourcePaths = {
std: "https://cdn.jsdelivr.net/npm/dynamsoft-capture-vision-std@1.4.10/dist/",
dip: "https://cdn.jsdelivr.net/npm/dynamsoft-image-processing@2.4.20/dist/",
core: "https://cdn.jsdelivr.net/npm/dynamsoft-core@3.4.20/dist/",
license: "https://cdn.jsdelivr.net/npm/dynamsoft-license@3.4.20/dist/",
cvr: "https://cdn.jsdelivr.net/npm/dynamsoft-capture-vision-router@2.4.21/dist/",
core: "https://cdn.jsdelivr.net/npm/dynamsoft-core@3.4.21/dist/",
license: "https://cdn.jsdelivr.net/npm/dynamsoft-license@3.4.21/dist/",
cvr: "https://cdn.jsdelivr.net/npm/dynamsoft-capture-vision-router@2.4.22/dist/",
dbr: "https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader@10.4.20/dist/",
dce: "https://cdn.jsdelivr.net/npm/dynamsoft-camera-enhancer@4.1.0/dist/",
utility: "https://cdn.jsdelivr.net/npm/dynamsoft-utility@1.4.20/dist/",
utility: "https://cdn.jsdelivr.net/npm/dynamsoft-utility@1.4.21/dist/",
};

// Files to cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function VideoCapture() {

// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
if (isDestroyed) {
throw Error(componentDestroyedErrorMsg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class VideoCapture extends React.Component {

// Open camera and start scanning single barcode.
await this.cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
if (this.isDestroyed) {
throw Error(componentDestroyedErrorMsg);
}
Expand Down
1 change: 1 addition & 0 deletions hello-world/requirejs.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ <h1>Hello World for RequireJS (Decode via Camera)</h1>

// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
await cvRouter.startCapturing("ReadSingleBarcode");
} catch (ex) {
let errMsg = ex.message || ex;
Expand Down
1 change: 1 addition & 0 deletions hello-world/svelte/src/components/VideoCapture.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
if (isDestroyed) {
throw Error(componentDestroyedErrorMsg);
}
Expand Down
1 change: 1 addition & 0 deletions hello-world/vue/src/components/VideoCapture.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ onMounted(async () => {
// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
if (isDestroyed) { throw Error(componentDestroyedErrorMsg); }
await cvRouter.startCapturing("ReadSingleBarcode");
if (isDestroyed) { throw Error(componentDestroyedErrorMsg); }
Expand Down
6 changes: 4 additions & 2 deletions others/debug/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,20 @@ <h1 style="font-size: 1.5em">Read Barcodes from Camera - Debug</h1>
let pInit = init();

document.getElementById("btn-start-capturing").addEventListener("click", async () => {
const { cameraEnhancer, cvRouter } = await pInit;
const { cameraEnhancer, cvRouter, cameraView } = await pInit;

// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
await cvRouter.startCapturing("ReadSingleBarcode");
});

document.getElementById("btn-stop-capturing").addEventListener("click", async () => {
const { cameraEnhancer, cvRouter } = await pInit;
const { cameraEnhancer, cvRouter, cameraView } = await pInit;

cvRouter.stopCapturing();
cameraEnhancer.close();
cameraView.setScanLaserVisible(false);
});

let switchVideoSettings = async () => {
Expand Down
5 changes: 3 additions & 2 deletions use-case/fill-a-form-with-barcode-reading.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ <h3>Click each input box to fill in!</h3>
inputsContainer.style.display = "";
loadingIndicator.style.display = "none";

return { cameraEnhancer, cvRouter };
return { cameraEnhancer, cvRouter, cameraView };
};

let pInit; // promise of init
Expand All @@ -128,7 +128,7 @@ <h3>Click each input box to fill in!</h3>
for (let input of allInputs) {
input.addEventListener("click", async function () {
try {
const { cameraEnhancer, cvRouter } = await (pInit = pInit || init());
const { cameraEnhancer, cvRouter, cameraView } = await (pInit = pInit || init());

// Define a callback for results.
const resultReceiver = {
Expand All @@ -150,6 +150,7 @@ <h3>Click each input box to fill in!</h3>

// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
await cvRouter.startCapturing("ReadSingleBarcode");
} catch (ex) {
let errMsg = ex.message || ex;
Expand Down
6 changes: 3 additions & 3 deletions use-case/locate-an-item-with-barcode/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ <h6 id="camera-switch-notification"></h6>
// [Optional] - Custom UI to select camera and resolution
try {
await cameraEnhancer.open();

// Populate a list of cameras and the resolution
const cameraList = await cameraEnhancer.getAllCameras();
// Get current camera and current resolution to set as selected
Expand Down Expand Up @@ -410,6 +409,7 @@ <h6 id="camera-switch-notification"></h6>
return {
cameraEnhancer,
cvRouter,
cameraView
};
};
let pInit; // promise of init
Expand All @@ -425,7 +425,7 @@ <h6 id="camera-switch-notification"></h6>

const itemIdInput = document.getElementById("item-id");
try {
const { cameraEnhancer, cvRouter } = await (pInit = pInit || init());
const { cameraEnhancer, cvRouter, cameraView } = await (pInit = pInit || init());

// Define a callback for results.
resultReceiver = {
Expand Down Expand Up @@ -520,7 +520,7 @@ <h6 id="camera-switch-notification"></h6>
closeButton.innerText = "Locate another item";

try {
const { cameraEnhancer, cvRouter } = await (pInit = pInit || init());
const { cameraEnhancer, cvRouter, cameraView } = await (pInit = pInit || init());

// Prepare to show overlay of the item ID on the CameraView
resultsContainer.innerHTML = "";
Expand Down
6 changes: 4 additions & 2 deletions use-case/read-a-drivers-license/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,12 @@ <h1>Read a Driver's License</h1>
}

async function switchToSingleFrameMode() {
const { cameraEnhancer, cvRouter } = await pInit;
const { cameraEnhancer, cvRouter, cameraView } = await pInit;
cvRouter.stopCapturing();
cameraEnhancer.close();
cameraEnhancer.singleFrameMode = "image";
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
await cvRouter.startCapturing("ReadDenseBarcodes");
}

Expand All @@ -208,11 +209,12 @@ <h1>Read a Driver's License</h1>
document.querySelector("#span-tip").hidden = false;
cameraViewContainer.style.display = "block";

const { cameraEnhancer, cvRouter } = await pInit;
const { cameraEnhancer, cvRouter, cameraView } = await pInit;
cvRouter.stopCapturing();
cameraEnhancer.close();
cameraEnhancer.singleFrameMode = "disabled";
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
await cvRouter.startCapturing("ReadDenseBarcodes");

messageDisplayTimer = setTimeout(() => {
Expand Down
1 change: 1 addition & 0 deletions use-case/show-result-texts-on-the-video.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ <h3>Scan barcodes to display results as overlays on video</h3>

// Open camera and start scanning single barcode.
await cameraEnhancer.open();
cameraView.setScanLaserVisible(true);
await cvRouter.startCapturing("ReadBarcodes_SpeedFirst");
} catch (ex) {
let errMsg = ex.message || ex;
Expand Down

0 comments on commit ed1dab0

Please sign in to comment.