30b56153db
Before, Frame Processors ran on a separate Thread. After, Frame Processors run fully synchronous and always at the same FPS as the Camera. Two new functions have been introduced: * `runAtTargetFps(fps: number, func: () => void)`: Runs the given code as often as the given `fps`, effectively throttling it's calls. * `runAsync(frame: Frame, func: () => void)`: Runs the given function on a separate Thread for Frame Processing. A strong reference to the Frame is held as long as the function takes to execute. You can use `runAtTargetFps` to throttle calls to a specific API (e.g. if your Camera is running at 60 FPS, but you only want to run face detection at ~25 FPS, use `runAtTargetFps(25, ...)`.) You can use `runAsync` to run a heavy algorithm asynchronous, so that the Camera is not blocked while your algorithm runs. This is useful if your main sync processor draws something, and your async processor is doing some image analysis on the side. You can also combine both functions. Examples: ```js const frameProcessor = useFrameProcessor((frame) => { 'worklet' console.log("I'm running at 60 FPS!") }, []) ``` ```js const frameProcessor = useFrameProcessor((frame) => { 'worklet' console.log("I'm running at 60 FPS!") runAtTargetFps(10, () => { 'worklet' console.log("I'm running at 10 FPS!") }) }, []) ``` ```js const frameProcessor = useFrameProcessor((frame) => { 'worklet' console.log("I'm running at 60 FPS!") runAsync(frame, () => { 'worklet' console.log("I'm running on another Thread, I can block for longer!") }) }, []) ``` ```js const frameProcessor = useFrameProcessor((frame) => { 'worklet' console.log("I'm running at 60 FPS!") runAtTargetFps(10, () => { 'worklet' runAsync(frame, () => { 'worklet' console.log("I'm running on another Thread at 10 FPS, I can block for longer!") }) }) }, []) ```
165 lines
4.2 KiB
JSON
165 lines
4.2 KiB
JSON
{
|
|
"name": "react-native-vision-camera",
|
|
"version": "2.15.4",
|
|
"description": "The Camera library that sees the vision.",
|
|
"main": "lib/commonjs/index",
|
|
"module": "lib/module/index",
|
|
"types": "lib/typescript/index.d.ts",
|
|
"react-native": "src/index",
|
|
"source": "src/index",
|
|
"files": [
|
|
"src",
|
|
"lib/commonjs",
|
|
"lib/module",
|
|
"lib/typescript",
|
|
"android/build.gradle",
|
|
"android/gradle.properties",
|
|
"android/CMakeLists.txt",
|
|
"android/src",
|
|
"ios/**/*.h",
|
|
"ios/**/*.m",
|
|
"ios/**/*.mm",
|
|
"ios/**/*.cpp",
|
|
"ios/**/*.swift",
|
|
"ios/VisionCamera.xcodeproj/project.pbxproj",
|
|
"app.plugin.js",
|
|
"VisionCamera.podspec",
|
|
"README.md"
|
|
],
|
|
"scripts": {
|
|
"typescript": "tsc --noEmit",
|
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
"lint-ci": "yarn lint -f ./node_modules/@firmnav/eslint-github-actions-formatter/dist/formatter.js",
|
|
"build": "bob build",
|
|
"release": "release-it",
|
|
"pods": "cd example && yarn pods",
|
|
"bootstrap": "yarn && cd example && yarn && yarn setup && yarn pods",
|
|
"check-android": "scripts/ktlint.sh && scripts/cpplint.sh",
|
|
"check-ios": "scripts/swiftformat.sh && scripts/swiftlint.sh",
|
|
"check-js": "yarn lint --fix && yarn typescript",
|
|
"check-all": "scripts/check-all.sh",
|
|
"clean-ios": "scripts/clean-ios.sh",
|
|
"clean-android": "scripts/clean-android.sh",
|
|
"clean-js": "scripts/clean-js.sh",
|
|
"docs": "cd docs && yarn build"
|
|
},
|
|
"keywords": [
|
|
"react-native",
|
|
"ios",
|
|
"android",
|
|
"camera",
|
|
"vision",
|
|
"native",
|
|
"module",
|
|
"react",
|
|
"ai",
|
|
"ar",
|
|
"qr",
|
|
"qr-code",
|
|
"scanner"
|
|
],
|
|
"repository": "https://github.com/mrousavy/react-native-vision-camera",
|
|
"author": "Marc Rousavy <marcrousavy@hotmail.com> (https://github.com/mrousavy)",
|
|
"license": "MIT",
|
|
"bugs": {
|
|
"url": "https://github.com/mrousavy/react-native-vision-camera/issues"
|
|
},
|
|
"homepage": "https://mrousavy.github.io/react-native-vision-camera/",
|
|
"publishConfig": {
|
|
"registry": "https://registry.npmjs.org/"
|
|
},
|
|
"devDependencies": {
|
|
"@expo/config-plugins": "^5.0.4",
|
|
"@jamesacarr/eslint-formatter-github-actions": "^0.1.0",
|
|
"@react-native-community/eslint-config": "^3.2.0",
|
|
"@react-native-community/eslint-plugin": "^1.3.0",
|
|
"@release-it/conventional-changelog": "^5.1.1",
|
|
"@types/react": "^18.0.27",
|
|
"@types/react-native": "^0.71.2",
|
|
"eslint": "^8.33.0",
|
|
"pod-install": "^0.1.38",
|
|
"prettier": "^2.8.4",
|
|
"react": "^18.2.0",
|
|
"react-native": "^0.71.3",
|
|
"react-native-builder-bob": "^0.20.3",
|
|
"react-native-worklets": "https://github.com/chrfalch/react-native-worklets#15d52dd",
|
|
"release-it": "^15.6.0",
|
|
"typescript": "^4.9.5"
|
|
},
|
|
"peerDependencies": {
|
|
"react": "*",
|
|
"react-native": "*",
|
|
"react-native-worklets": "*"
|
|
},
|
|
"prettier": {
|
|
"bracketSpacing": true,
|
|
"bracketSameLine": true,
|
|
"singleQuote": true,
|
|
"trailingComma": "all",
|
|
"semi": true,
|
|
"tabWidth": 2,
|
|
"useTabs": false,
|
|
"printWidth": 140
|
|
},
|
|
"babel": {
|
|
"presets": [
|
|
"module:metro-react-native-babel-preset"
|
|
]
|
|
},
|
|
"release-it": {
|
|
"git": {
|
|
"commitMessage": "chore: release ${version}",
|
|
"tagName": "v${version}"
|
|
},
|
|
"npm": {
|
|
"publish": true
|
|
},
|
|
"github": {
|
|
"release": true
|
|
},
|
|
"plugins": {
|
|
"@release-it/conventional-changelog": {
|
|
"preset": {
|
|
"name": "conventionalcommits",
|
|
"types": [
|
|
{
|
|
"type": "feat",
|
|
"section": "✨ Features"
|
|
},
|
|
{
|
|
"type": "fix",
|
|
"section": "🐛 Bug Fixes"
|
|
},
|
|
{
|
|
"type": "perf",
|
|
"section": "💨 Performance Improvements"
|
|
},
|
|
{
|
|
"type": "chore(deps)",
|
|
"section": "🛠️ Dependency Upgrades"
|
|
},
|
|
{
|
|
"type": "docs",
|
|
"section": "📚 Documentation"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"react-native-builder-bob": {
|
|
"source": "src",
|
|
"output": "lib",
|
|
"targets": [
|
|
"commonjs",
|
|
"module",
|
|
[
|
|
"typescript",
|
|
{
|
|
"project": "tsconfig.json"
|
|
}
|
|
]
|
|
]
|
|
}
|
|
}
|