Skip to content

Commit 14ce610

Browse files
committed
add singleFrameMode
1 parent b744de7 commit 14ce610

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ <h1>Use the Default Built-in UI</h1>
2121
*/
2222

2323
Dynamsoft.DBR.BarcodeReader.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
24-
24+
2525
/**
2626
* 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.
2727
* 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.
@@ -43,14 +43,33 @@ <h1>Use the Default Built-in UI</h1>
4343
document.getElementById('showScanner').addEventListener('click', async () => {
4444
try {
4545
let scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
46+
if(scanner.singleFrameMode) {
47+
scanner.singleFrameMode = false;
48+
document.querySelector('.dce-sel-camera').style.display = "block";
49+
document.querySelector('.dce-sel-resolution').style.display = "block";
50+
}
4651
scanner.onUniqueRead = (txt, result) => { alert(txt); };
4752
document.getElementById('UIElement').appendChild(scanner.getUIElement());
4853
await scanner.show();
4954
} catch (ex) {
5055
alert(ex.message);
56+
setSingleFrameMode();
5157
throw ex;
5258
}
5359
});
60+
async function setSingleFrameMode() {
61+
try {
62+
let scanner = await(pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
63+
scanner.hide();
64+
scanner.singleFrameMode = true;
65+
document.querySelector('.dce-sel-camera').style.display = "none";
66+
document.querySelector('.dce-sel-resolution').style.display = "none";
67+
await scanner.show();
68+
} catch (ex) {
69+
alert(ex.message);
70+
throw ex;
71+
}
72+
}
5473
</script>
5574
</body>
5675
<style>

0 commit comments

Comments
 (0)