|
97 | 97 | #js {:video true :audio false})") |
98 | 98 |
|
99 | 99 | ;; This is the same technology used by: |
| 100 | +;; |
100 | 101 | ;; - Video conferencing apps (Zoom, Google Meet) |
101 | 102 | ;; - Social media camera features (Instagram, Snapchat) |
102 | 103 | ;; - WebRTC peer-to-peer video calls |
103 | 104 |
|
104 | 105 | ;; **2. HTML5 Canvas API** |
105 | 106 |
|
106 | 107 | ;; The Canvas API allows us to: |
| 108 | +;; |
107 | 109 | ;; - Capture video frames as images |
108 | 110 | ;; - Extract pixel data for processing |
109 | 111 | ;; - Draw overlays and visual feedback |
|
120 | 122 | ;; **3. jsQR Library** |
121 | 123 |
|
122 | 124 | ;; jsQR is a pure JavaScript QR code detection library that: |
| 125 | +;; |
123 | 126 | ;; - Works entirely in the browser (no server needed) |
124 | 127 | ;; - Processes ImageData from canvas |
125 | 128 | ;; - Returns decoded QR code content |
|
174 | 177 | :error nil})) ; Error message") |
175 | 178 |
|
176 | 179 | ;; This simple state management pattern: |
| 180 | +;; |
177 | 181 | ;; - Keeps everything in one place |
178 | 182 | ;; - Makes state updates predictable |
179 | 183 | ;; - Works perfectly with Reagent's reactivity |
|
193 | 197 | :on-error (fn [error] ...)})") |
194 | 198 |
|
195 | 199 | ;; Benefits of keyword arguments: |
| 200 | +;; |
196 | 201 | ;; - **Self-documenting** - Clear what each parameter does |
197 | 202 | ;; - **Flexible** - Order doesn't matter |
198 | 203 | ;; - **Optional parameters** - Easy to add defaults |
|
203 | 208 | ;; The scanner has several key functions: |
204 | 209 |
|
205 | 210 | ;; **Camera Management:** |
| 211 | +;; |
206 | 212 | ;; - `start-stream!` - Request camera access with callbacks |
207 | 213 | ;; - `stop-stream!` - Clean up camera resources |
208 | 214 |
|
209 | 215 | ;; **Scanning Functions:** |
| 216 | +;; |
210 | 217 | ;; - `scan-qr-code` - Capture frame and detect QR codes |
211 | 218 | ;; - `start-qr-scanning!` - Begin continuous scanning loop |
212 | 219 | ;; - `stop-qr-scanning!` - Stop the scanning loop |
213 | 220 |
|
214 | 221 | ;; **Utility Functions:** |
| 222 | +;; |
215 | 223 | ;; - `copy-to-clipboard!` - Copy results to clipboard |
216 | 224 | ;; - `clear-qr-results!` - Clear all scanned results |
217 | 225 | ;; - `generate-id` - Create unique IDs for results |
|
0 commit comments