Fix receiver: stale closure + add GIF file test mode

- Fix stale closure bug in camera capture loop (scanning state
  captured as false, preventing any frame capture)
- Add GIF File input mode to receiver — upload a QR-over-GIF
  directly to test the decode pipeline without camera
- Update decode worker to accept imageData or frameData
- Receiver now shows two input modes: Camera and GIF File
This commit is contained in:
Hermes Agent
2026-05-02 22:22:42 +00:00
parent 0241068994
commit 6f3f0b2ee2
2 changed files with 237 additions and 115 deletions
+3 -1
View File
@@ -53,8 +53,10 @@ self.onmessage = (e: MessageEvent) => {
}
if (msg.type === 'frame') {
const imageData: ImageData = msg.imageData ?? msg.frameData;
if (!imageData) return;
try {
handleFrame(msg.imageData as ImageData);
handleFrame(imageData);
} catch (err: any) {
// Don't crash worker on decode errors
self.postMessage({ type: 'error', message: err.message ?? String(err) });