(videoFrame, controller)
| 75 | |
| 76 | const transformer = new TransformStream({ |
| 77 | async transform(videoFrame, controller) { |
| 78 | const bitmap = await createImageBitmap(videoFrame); |
| 79 | const detectedBarcodes = await barcodeDetector.detect(bitmap); |
| 80 | if (!detectedBarcodes.length) { |
| 81 | bitmap.close(); |
| 82 | controller.enqueue(videoFrame); |
| 83 | return; |
| 84 | } |
| 85 | const timestamp = videoFrame.timestamp; |
| 86 | videoFrame.close(); |
| 87 | const newFrame = await highlightBarcode( |
| 88 | bitmap, |
| 89 | timestamp, |
| 90 | detectedBarcodes |
| 91 | ); |
| 92 | controller.enqueue(newFrame); |
| 93 | }, |
| 94 | |
| 95 | flush(controller) { |
| 96 | controller.terminate(); |
nothing calls this directly
no test coverage detected