Skip to content

Commit 709722f

Browse files
committed
Add small fix
1 parent b3a286e commit 709722f

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

ui/components/app/qr-hardware-popover/enhanced-qr-reader/enhanced-qr-reader.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ describe('EnhancedQrReader', () => {
9494
expect.objectContaining({
9595
audio: false,
9696
video: expect.objectContaining({
97-
width: { min: 640, ideal: 1280 },
98-
height: { min: 480, ideal: 720 },
97+
width: { ideal: 1280 },
98+
height: { ideal: 720 },
9999
}),
100100
}),
101101
expect.any(HTMLVideoElement),

ui/components/app/qr-hardware-popover/enhanced-qr-reader/enhanced-qr-reader.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ const SCAN_ATTEMPT_DELAY_MS = MILLISECOND * 80;
1414
// animated multi-part UR QR codes are captured faster.
1515
const SCAN_SUCCESS_DELAY_MS = MILLISECOND * 50;
1616

17-
// Video constraints requesting HD resolution for clearer QR detection.
18-
// The `ideal` values let the browser negotiate the best available
19-
// resolution without failing if the camera cannot reach 720p.
17+
// Request HD resolution for clearer QR detection. Uses `ideal` rather
18+
// than `min` so cameras that cannot deliver 720p still work.
2019
const VIDEO_CONSTRAINTS: MediaStreamConstraints = {
2120
audio: false,
2221
video: {
23-
width: { min: 640, ideal: 1280 },
24-
height: { min: 480, ideal: 720 },
22+
width: { ideal: 1280 },
23+
height: { ideal: 720 },
2524
},
2625
};
2726

@@ -87,6 +86,10 @@ const EnhancedQrReader = ({ onFrame }: EnhancedQrReaderProps) => {
8786
},
8887
);
8988

89+
// Prevent unhandled rejection if the stream fails to start (e.g.
90+
// camera disconnected between the permission probe and here).
91+
promise.catch(log.debug);
92+
9093
return () => {
9194
promise.then((controls) => controls?.stop()).catch(log.debug);
9295
};

0 commit comments

Comments
 (0)