Skip to content

Commit

Permalink
add commented final code
Browse files Browse the repository at this point in the history
  • Loading branch information
luicfrr committed May 16, 2024
1 parent 710b526 commit 2fd77a2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Camera.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from 'react'
import {
Camera as VisionCamera,
// runAsync,
useFrameProcessor
} from 'react-native-vision-camera'
import {
Worklets,
// useRunOnJS,
useSharedValue
} from 'react-native-worklets-core'
import { useFaceDetector } from './FaceDetector'
Expand Down Expand Up @@ -176,6 +178,28 @@ export const Camera = React.forwardRef( ( {
runAsync( frame )
}, [ runOnAsyncContext ] )

//
// use bellow when vision-camera's
// context creation issue is solved
//
// /**
// * Runs on detection callback on js thread
// */
// const runOnJs = useRunOnJS( faceDetectionCallback, [
// faceDetectionCallback
// ] )

// const cameraFrameProcessor = useFrameProcessor( ( frame ) => {
// 'worklet'
// runAsync( frame, () => {
// 'worklet'
// runOnJs(
// detectFaces( frame ),
// frame
// )
// } )
// }, [ runOnJs ] )

return <VisionCamera
{ ...props }
ref={ ref }
Expand Down

0 comments on commit 2fd77a2

Please sign in to comment.