feat: Add console
logging support for Frame Processors (#297)
* Try to log to console via runOnJS * Call `console.log` * Create custom `VisionCameraScheduler` * Fix scheduler call * Call with this * Fix console setting * Move J---- to `java-bindings` * c++ style * Android: 1/2 Create custom Scheduler * Android: 2/2 Use custom Scheduler * Don't use `runOnJS`, use `__callAsync` directly
This commit is contained in:
@@ -19,7 +19,7 @@ function App() {
|
||||
const frameProcessor = useFrameProcessor((frame) => {
|
||||
'worklet'
|
||||
const qrCodes = scanQRCodes(frame)
|
||||
_log(`QR Codes in Frame: ${qrCodes}`)
|
||||
console.log(`QR Codes in Frame: ${qrCodes}`)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
@@ -62,7 +62,7 @@ Returns a `string` in JS:
|
||||
export function detectObject(frame: Frame): string {
|
||||
'worklet'
|
||||
const result = __detectObject(frame)
|
||||
_log(result) // <-- "cat"
|
||||
console.log(result) // <-- "cat"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,7 +86,7 @@ const frameProcessor = useFrameProcessor((frame) => {
|
||||
|
||||
// by downscaling the frame, the `detectObjects` function runs faster.
|
||||
const objects = detectObjects(resizedFrame)
|
||||
_log(objects)
|
||||
console.log(objects)
|
||||
}, [])
|
||||
```
|
||||
|
||||
@@ -133,7 +133,7 @@ const frameProcessor = useFrameProcessor((frame) => {
|
||||
try {
|
||||
const codes = scanCodes(frame, true)
|
||||
} catch (e) {
|
||||
_log(`Error: ${e.message}`)
|
||||
console.log(`Error: ${e.message}`)
|
||||
}
|
||||
}, [])
|
||||
```
|
||||
|
@@ -48,7 +48,7 @@ function App() {
|
||||
const frameProcessor = useFrameProcessor((frame) => {
|
||||
'worklet'
|
||||
const qrCodes = scanQRCodes(frame)
|
||||
_log(`QR Codes in Frame: ${qrCodes}`)
|
||||
console.log(`QR Codes in Frame: ${qrCodes}`)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user