@@ -159,16 +159,13 @@ export default {
159
159
const {signal } = abortController;
160
160
const barcodes = await detectBarcodes ({barcodeDetector, video, signal});
161
161
const [result ] = barcodes;
162
- if (result? .format && result? .rawValue ) {
163
- emit (' result' , {type: result .format , text: result .rawValue });
164
- }
162
+ emit (' result' , {type: result .format , text: result .rawValue });
165
163
}
166
164
167
165
function startBarcodeDetection () {
168
166
// Get video element
169
167
const video = document .querySelector (
170
- ' #dce-video-container > video'
171
- );
168
+ ' #dce-video-container > video' );
172
169
const {BarcodeDetector } = globalThis ;
173
170
// Check if BarcodeDetector is supported
174
171
if (! BarcodeDetector) {
@@ -178,10 +175,8 @@ export default {
178
175
const barcodeDetector = new BarcodeDetector ({
179
176
formats: formatsToSupport
180
177
});
181
- // Start the detection loop
182
- video .requestVideoFrameCallback (
183
- () => emitScanResult ({barcodeDetector, video})
184
- );
178
+ // emit the first scanned result
179
+ emitScanResult ({barcodeDetector, video});
185
180
}
186
181
187
182
// Update camera zoom
0 commit comments