chore: Move everything into package/ (#1745)

* Move everything into package

* Remove .DS_Store

* Move scripts and eslintrc to package

* Create CODE_OF_CONDUCT.md

* fix some links

* Update all links (I think)

* Update generated docs

* Update notice-yarn-changes.yml

* Update validate-android.yml

* Update validate-cpp.yml

* Delete notice-yarn-changes.yml

* Update validate-cpp.yml

* Update validate-cpp.yml

* Update validate-js.yml

* Update validate-cpp.yml

* Update validate-cpp.yml

* wrong c++ style

* Revert "wrong c++ style"

This reverts commit 55a3575589c6f13f8b05134d83384f55e0601ab2.
This commit is contained in:
Marc Rousavy 2023-09-01 18:15:28 +02:00 committed by GitHub
parent 2a5c33323b
commit 036856aed5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
347 changed files with 3088 additions and 154 deletions

View File

@ -24,6 +24,9 @@ jobs:
build:
name: Build Android Example App
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./package
steps:
- uses: actions/checkout@v2
@ -63,6 +66,9 @@ jobs:
build-no-frame-processors:
name: Build Android Example App (without Frame Processors)
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./package
steps:
- uses: actions/checkout@v2

View File

@ -24,7 +24,7 @@ jobs:
runs-on: macOS-latest
defaults:
run:
working-directory: example/ios
working-directory: package/example/ios
steps:
- uses: actions/checkout@v2
@ -84,7 +84,7 @@ jobs:
runs-on: macOS-latest
defaults:
run:
working-directory: example/ios
working-directory: package/example/ios
steps:
- uses: actions/checkout@v2

View File

@ -1,19 +0,0 @@
name: Notice yarn.lock changes
on: [pull_request]
jobs:
check:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Notice yarn.lock changes
uses: Simek/yarn-lock-changes@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
collapsibleThreshold: '25'
failOnDowngrade: 'false'
path: 'yarn.lock'
updateComment: 'true'

View File

@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./android
working-directory: ./package/android
steps:
- uses: actions/checkout@v2
- name: Setup JDK 11

View File

@ -6,15 +6,15 @@ on:
- main
paths:
- '.github/workflows/validate-cpp.yml'
- 'cpp/**'
- 'android/src/main/cpp/**'
- 'ios/**'
- 'package/cpp/**'
- 'package/android/src/main/cpp/**'
- 'package/ios/**'
pull_request:
paths:
- '.github/workflows/validate-cpp.yml'
- 'cpp/**'
- 'android/src/main/cpp/**'
- 'ios/**'
- 'package/cpp/**'
- 'package/android/src/main/cpp/**'
- 'package/ios/**'
jobs:
lint:
@ -23,14 +23,15 @@ jobs:
strategy:
matrix:
path:
- 'cpp'
- 'android/src/main/cpp'
- 'ios'
- 'package/cpp'
- 'package/android/src/main/cpp'
- 'package/ios'
steps:
- uses: actions/checkout@v2
- name: Run clang-format style check
uses: jidicula/clang-format-action@v4.11.0
uses: mrousavy/clang-format-action@v1
with:
clang-format-version: '16'
check-path: ${{ matrix.path }}
clang-format-style-path: package/cpp/.clang-format

View File

@ -15,6 +15,9 @@ on:
jobs:
SwiftLint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./package
steps:
- uses: actions/checkout@v2
- name: Run SwiftLint GitHub Action (--strict)
@ -27,7 +30,7 @@ jobs:
runs-on: macOS-latest
defaults:
run:
working-directory: ./ios
working-directory: ./package/ios
steps:
- uses: actions/checkout@v2

View File

@ -6,32 +6,35 @@ on:
- main
paths:
- '.github/workflows/validate-js.yml'
- 'src/**'
- '*.json'
- '*.js'
- '*.lock'
- 'example/src/**'
- 'example/*.json'
- 'example/*.js'
- 'example/*.lock'
- 'example/*.tsx'
- 'package/src/**'
- 'package/*.json'
- 'package/*.js'
- 'package/*.lock'
- 'package/example/src/**'
- 'package/example/*.json'
- 'package/example/*.js'
- 'package/example/*.lock'
- 'package/example/*.tsx'
pull_request:
paths:
- '.github/workflows/validate-js.yml'
- 'src/**'
- '*.json'
- '*.js'
- '*.lock'
- 'example/src/**'
- 'example/*.json'
- 'example/*.js'
- 'example/*.lock'
- 'example/*.tsx'
- 'package/src/**'
- 'package/*.json'
- 'package/*.js'
- 'package/*.lock'
- 'package/example/src/**'
- 'package/example/*.json'
- 'package/example/*.js'
- 'package/example/*.lock'
- 'package/example/*.tsx'
jobs:
compile:
name: Compile JS (tsc)
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./package
steps:
- uses: actions/checkout@v2
@ -70,6 +73,9 @@ jobs:
lint:
name: Lint JS (eslint, prettier)
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./package
steps:
- uses: actions/checkout@v2

69
.gitignore vendored
View File

@ -1,70 +1 @@
# OSX
#
.DS_Store
# XDE
.expo/
# VSCode
jsconfig.json
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# Android/IJ
#
.idea
.gradle
local.properties
android.iml
*.hprof
# Cocoapods
#
example/ios/Pods
# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore
# Expo
.expo/*
# generated by bob
lib/
# we only use yarn
package-lock.json
# TypeDoc/Docusaurus stuff
docs/docs/api
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

76
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by creating an issue on the GitHub repository. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@ -39,7 +39,7 @@ cd ios && pod install
* [Guides](https://react-native-vision-camera.com/docs/guides)
* [API](https://react-native-vision-camera.com/docs/api)
* [Example](./example/)
* [Example](./package/example/)
* [Frame Processor Plugins](https://react-native-vision-camera.com/docs/guides/frame-processor-plugin-list)
### Example
@ -60,7 +60,7 @@ function App() {
}
```
> See the [example](./example/) app
> See the [example](./package/example/) app
### Adopting at scale

View File

@ -0,0 +1 @@
label: "API"

View File

@ -0,0 +1,383 @@
---
id: "Camera"
title: "Camera"
sidebar_position: 0
custom_edit_url: null
---
### A powerful `<Camera>` component.
Read the [VisionCamera documentation](https://react-native-vision-camera.com/) for more information.
The `<Camera>` component's most important (and therefore _required_) properties are:
* [`device`](../interfaces/CameraProps.md#device): Specifies the [`CameraDevice`](../interfaces/CameraDevice.md) to use. Get a [`CameraDevice`](../interfaces/CameraDevice.md) by using the [`useCameraDevices()`](../#usecameradevices) hook, or manually by using the [`Camera.getAvailableCameraDevices()`](Camera.md#getavailablecameradevices) function.
* [`isActive`](../interfaces/CameraProps.md#isactive): A boolean value that specifies whether the Camera should actively stream video frames or not. This can be compared to a Video component, where `isActive` specifies whether the video is paused or not. If you fully unmount the `<Camera>` component instead of using `isActive={false}`, the Camera will take a bit longer to start again.
**`Example`**
```tsx
function App() {
const devices = useCameraDevices('wide-angle-camera')
const device = devices.back
if (device == null) return <LoadingView />
return (
<Camera
style={StyleSheet.absoluteFill}
device={device}
isActive={true}
/>
)
}
```
**`Component`**
## Hierarchy
- `PureComponent`<[`CameraProps`](../interfaces/CameraProps.md)\>
**`Camera`**
## Methods
### focus
**focus**(`point`): `Promise`<`void`\>
Focus the camera to a specific point in the coordinate system.
**`Throws`**
[`CameraRuntimeError`](CameraRuntimeError.md) When any kind of error occured while focussing. Use the [`code`](CameraRuntimeError.md#code) property to get the actual error
**`Example`**
```ts
await camera.current.focus({
x: tapEvent.x,
y: tapEvent.y
})
```
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `point` | [`Point`](../interfaces/Point.md) | The point to focus to. This should be relative to the Camera view's coordinate system, and expressed in Pixel on iOS and Points on Android. * `(0, 0)` means **top left**. * `(CameraView.width, CameraView.height)` means **bottom right**. Make sure the value doesn't exceed the CameraView's dimensions. |
#### Returns
`Promise`<`void`\>
#### Defined in
[Camera.tsx:250](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L250)
___
### pauseRecording
**pauseRecording**(): `Promise`<`void`\>
Pauses the current video recording.
**`Throws`**
[`CameraCaptureError`](CameraCaptureError.md) When any kind of error occured while pausing the video recording. Use the [`code`](CameraCaptureError.md#code) property to get the actual error
**`Example`**
```ts
// Start
await camera.current.startRecording()
await timeout(1000)
// Pause
await camera.current.pauseRecording()
await timeout(500)
// Resume
await camera.current.resumeRecording()
await timeout(2000)
// Stop
const video = await camera.current.stopRecording()
```
#### Returns
`Promise`<`void`\>
#### Defined in
[Camera.tsx:175](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L175)
___
### resumeRecording
**resumeRecording**(): `Promise`<`void`\>
Resumes a currently paused video recording.
**`Throws`**
[`CameraCaptureError`](CameraCaptureError.md) When any kind of error occured while resuming the video recording. Use the [`code`](CameraCaptureError.md#code) property to get the actual error
**`Example`**
```ts
// Start
await camera.current.startRecording()
await timeout(1000)
// Pause
await camera.current.pauseRecording()
await timeout(500)
// Resume
await camera.current.resumeRecording()
await timeout(2000)
// Stop
const video = await camera.current.stopRecording()
```
#### Returns
`Promise`<`void`\>
#### Defined in
[Camera.tsx:203](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L203)
___
### startRecording
**startRecording**(`options`): `void`
Start a new video recording.
Records in the following formats:
* **iOS**: QuickTime (`.mov`)
* **Android**: MPEG4 (`.mp4`)
**`Blocking`**
This function is synchronized/blocking.
**`Throws`**
[`CameraCaptureError`](CameraCaptureError.md) When any kind of error occured while starting the video recording. Use the [`code`](CameraCaptureError.md#code) property to get the actual error
**`Example`**
```ts
camera.current.startRecording({
onRecordingFinished: (video) => console.log(video),
onRecordingError: (error) => console.error(error),
})
setTimeout(() => {
camera.current.stopRecording()
}, 5000)
```
#### Parameters
| Name | Type |
| :------ | :------ |
| `options` | [`RecordVideoOptions`](../interfaces/RecordVideoOptions.md) |
#### Returns
`void`
#### Defined in
[Camera.tsx:138](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L138)
___
### stopRecording
**stopRecording**(): `Promise`<`void`\>
Stop the current video recording.
**`Throws`**
[`CameraCaptureError`](CameraCaptureError.md) When any kind of error occured while stopping the video recording. Use the [`code`](CameraCaptureError.md#code) property to get the actual error
**`Example`**
```ts
await camera.current.startRecording()
setTimeout(async () => {
const video = await camera.current.stopRecording()
}, 5000)
```
#### Returns
`Promise`<`void`\>
#### Defined in
[Camera.tsx:224](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L224)
___
### takePhoto
**takePhoto**(`options?`): `Promise`<[`PhotoFile`](../interfaces/PhotoFile.md)\>
Take a single photo and write it's content to a temporary file.
**`Throws`**
[`CameraCaptureError`](CameraCaptureError.md) When any kind of error occured while capturing the photo. Use the [`code`](CameraCaptureError.md#code) property to get the actual error
**`Example`**
```ts
const photo = await camera.current.takePhoto({
qualityPrioritization: 'quality',
flash: 'on',
enableAutoRedEyeReduction: true
})
```
#### Parameters
| Name | Type |
| :------ | :------ |
| `options?` | [`TakePhotoOptions`](../interfaces/TakePhotoOptions.md) |
#### Returns
`Promise`<[`PhotoFile`](../interfaces/PhotoFile.md)\>
#### Defined in
[Camera.tsx:108](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L108)
___
### getAvailableCameraDevices
`Static` **getAvailableCameraDevices**(): `Promise`<[`CameraDevice`](../interfaces/CameraDevice.md)[]\>
Get a list of all available camera devices on the current phone.
**`Throws`**
[`CameraRuntimeError`](CameraRuntimeError.md) When any kind of error occured while getting all available camera devices. Use the [`code`](CameraRuntimeError.md#code) property to get the actual error
**`Example`**
```ts
const devices = await Camera.getAvailableCameraDevices()
const filtered = devices.filter((d) => matchesMyExpectations(d))
const sorted = devices.sort(sortDevicesByAmountOfCameras)
return {
back: sorted.find((d) => d.position === "back"),
front: sorted.find((d) => d.position === "front")
}
```
#### Returns
`Promise`<[`CameraDevice`](../interfaces/CameraDevice.md)[]\>
#### Defined in
[Camera.tsx:276](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L276)
___
### getCameraPermissionStatus
`Static` **getCameraPermissionStatus**(): `Promise`<[`CameraPermissionStatus`](../#camerapermissionstatus)\>
Gets the current Camera Permission Status. Check this before mounting the Camera to ensure
the user has permitted the app to use the camera.
To actually prompt the user for camera permission, use [`requestCameraPermission()`](Camera.md#requestcamerapermission).
**`Throws`**
[`CameraRuntimeError`](CameraRuntimeError.md) When any kind of error occured while getting the current permission status. Use the [`code`](CameraRuntimeError.md#code) property to get the actual error
#### Returns
`Promise`<[`CameraPermissionStatus`](../#camerapermissionstatus)\>
#### Defined in
[Camera.tsx:291](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L291)
___
### getMicrophonePermissionStatus
`Static` **getMicrophonePermissionStatus**(): `Promise`<[`CameraPermissionStatus`](../#camerapermissionstatus)\>
Gets the current Microphone-Recording Permission Status. Check this before mounting the Camera to ensure
the user has permitted the app to use the microphone.
To actually prompt the user for microphone permission, use [`requestMicrophonePermission()`](Camera.md#requestmicrophonepermission).
**`Throws`**
[`CameraRuntimeError`](CameraRuntimeError.md) When any kind of error occured while getting the current permission status. Use the [`code`](CameraRuntimeError.md#code) property to get the actual error
#### Returns
`Promise`<[`CameraPermissionStatus`](../#camerapermissionstatus)\>
#### Defined in
[Camera.tsx:306](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L306)
___
### requestCameraPermission
`Static` **requestCameraPermission**(): `Promise`<[`CameraPermissionRequestResult`](../#camerapermissionrequestresult)\>
Shows a "request permission" alert to the user, and resolves with the new camera permission status.
If the user has previously blocked the app from using the camera, the alert will not be shown
and `"denied"` will be returned.
**`Throws`**
[`CameraRuntimeError`](CameraRuntimeError.md) When any kind of error occured while requesting permission. Use the [`code`](CameraRuntimeError.md#code) property to get the actual error
#### Returns
`Promise`<[`CameraPermissionRequestResult`](../#camerapermissionrequestresult)\>
#### Defined in
[Camera.tsx:321](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L321)
___
### requestMicrophonePermission
`Static` **requestMicrophonePermission**(): `Promise`<[`CameraPermissionRequestResult`](../#camerapermissionrequestresult)\>
Shows a "request permission" alert to the user, and resolves with the new microphone permission status.
If the user has previously blocked the app from using the microphone, the alert will not be shown
and `"denied"` will be returned.
**`Throws`**
[`CameraRuntimeError`](CameraRuntimeError.md) When any kind of error occured while requesting permission. Use the [`code`](CameraRuntimeError.md#code) property to get the actual error
#### Returns
`Promise`<[`CameraPermissionRequestResult`](../#camerapermissionrequestresult)\>
#### Defined in
[Camera.tsx:336](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L336)

View File

@ -0,0 +1,88 @@
---
id: "CameraCaptureError"
title: "CameraCaptureError"
sidebar_position: 0
custom_edit_url: null
---
Represents any kind of error that occured while trying to capture a video or photo.
See the ["Camera Errors" documentation](https://react-native-vision-camera.com/docs/guides/errors) for more information about Camera Errors.
## Hierarchy
- `CameraError`<[`CaptureError`](../#captureerror)\>
**`CameraCaptureError`**
## Accessors
### cause
`get` **cause**(): `undefined` \| `Error`
#### Returns
`undefined` \| `Error`
#### Inherited from
CameraError.cause
#### Defined in
[CameraError.ts:132](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L132)
___
### code
`get` **code**(): `TCode`
#### Returns
`TCode`
#### Inherited from
CameraError.code
#### Defined in
[CameraError.ts:126](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L126)
___
### message
`get` **message**(): `string`
#### Returns
`string`
#### Inherited from
CameraError.message
#### Defined in
[CameraError.ts:129](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L129)
## Methods
### toString
**toString**(): `string`
#### Returns
`string`
#### Inherited from
CameraError.toString
#### Defined in
[CameraError.ts:150](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L150)

View File

@ -0,0 +1,88 @@
---
id: "CameraRuntimeError"
title: "CameraRuntimeError"
sidebar_position: 0
custom_edit_url: null
---
Represents any kind of error that occured in the Camera View Module.
See the ["Camera Errors" documentation](https://react-native-vision-camera.com/docs/guides/errors) for more information about Camera Errors.
## Hierarchy
- `CameraError`<[`PermissionError`](../#permissionerror) \| [`ParameterError`](../#parametererror) \| [`DeviceError`](../#deviceerror) \| [`FormatError`](../#formaterror) \| [`SessionError`](../#sessionerror) \| [`SystemError`](../#systemerror) \| [`UnknownError`](../#unknownerror)\>
**`CameraRuntimeError`**
## Accessors
### cause
`get` **cause**(): `undefined` \| `Error`
#### Returns
`undefined` \| `Error`
#### Inherited from
CameraError.cause
#### Defined in
[CameraError.ts:132](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L132)
___
### code
`get` **code**(): `TCode`
#### Returns
`TCode`
#### Inherited from
CameraError.code
#### Defined in
[CameraError.ts:126](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L126)
___
### message
`get` **message**(): `string`
#### Returns
`string`
#### Inherited from
CameraError.message
#### Defined in
[CameraError.ts:129](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L129)
## Methods
### toString
**toString**(): `string`
#### Returns
`string`
#### Inherited from
CameraError.toString
#### Defined in
[CameraError.ts:150](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L150)

View File

@ -0,0 +1,2 @@
label: "Classes"
position: 3

636
docs/docs/api/index.md Normal file
View File

@ -0,0 +1,636 @@
---
id: "index"
title: "VisionCamera"
sidebar_label: "Overview"
sidebar_position: 0.5
custom_edit_url: null
---
## Classes
- [Camera](classes/Camera.md)
- [CameraCaptureError](classes/CameraCaptureError.md)
- [CameraRuntimeError](classes/CameraRuntimeError.md)
## Interfaces
- [CameraDevice](interfaces/CameraDevice.md)
- [CameraDeviceFormat](interfaces/CameraDeviceFormat.md)
- [CameraProps](interfaces/CameraProps.md)
- [ErrorWithCause](interfaces/ErrorWithCause.md)
- [PhotoFile](interfaces/PhotoFile.md)
- [Point](interfaces/Point.md)
- [RecordVideoOptions](interfaces/RecordVideoOptions.md)
- [TakePhotoOptions](interfaces/TakePhotoOptions.md)
- [TemporaryFile](interfaces/TemporaryFile.md)
- [VideoFile](interfaces/VideoFile.md)
## Type Aliases
### AutoFocusSystem
Ƭ **AutoFocusSystem**: ``"contrast-detection"`` \| ``"phase-detection"`` \| ``"none"``
Indicates a format's autofocus system.
* `"none"`: Indicates that autofocus is not available
* `"contrast-detection"`: Indicates that autofocus is achieved by contrast detection. Contrast detection performs a focus scan to find the optimal position
* `"phase-detection"`: Indicates that autofocus is achieved by phase detection. Phase detection has the ability to achieve focus in many cases without a focus scan. Phase detection autofocus is typically less visually intrusive than contrast detection autofocus
#### Defined in
[CameraDevice.ts:53](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L53)
___
### CameraDevices
Ƭ **CameraDevices**: { [key in CameraPosition]: CameraDevice \| undefined }
#### Defined in
[hooks/useCameraDevices.ts:7](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/hooks/useCameraDevices.ts#L7)
___
### CameraPermissionRequestResult
Ƭ **CameraPermissionRequestResult**: ``"granted"`` \| ``"denied"``
#### Defined in
[Camera.tsx:15](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L15)
___
### CameraPermissionStatus
Ƭ **CameraPermissionStatus**: ``"granted"`` \| ``"not-determined"`` \| ``"denied"`` \| ``"restricted"``
#### Defined in
[Camera.tsx:14](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Camera.tsx#L14)
___
### CameraPosition
Ƭ **CameraPosition**: ``"front"`` \| ``"back"`` \| ``"unspecified"`` \| ``"external"``
Represents the camera device position.
* `"back"`: Indicates that the device is physically located on the back of the system hardware
* `"front"`: Indicates that the device is physically located on the front of the system hardware
#### iOS only
* `"unspecified"`: Indicates that the device's position relative to the system hardware is unspecified
#### Android only
* `"external"`: The camera device is an external camera, and has no fixed facing relative to the device's screen. (Android only)
#### Defined in
[CameraPosition.ts:13](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraPosition.ts#L13)
___
### CaptureError
Ƭ **CaptureError**: ``"capture/invalid-photo-format"`` \| ``"capture/encoder-error"`` \| ``"capture/muxer-error"`` \| ``"capture/recording-in-progress"`` \| ``"capture/no-recording-in-progress"`` \| ``"capture/file-io-error"`` \| ``"capture/create-temp-file-error"`` \| ``"capture/invalid-video-options"`` \| ``"capture/create-recorder-error"`` \| ``"capture/recorder-error"`` \| ``"capture/no-valid-data"`` \| ``"capture/inactive-source"`` \| ``"capture/insufficient-storage"`` \| ``"capture/file-size-limit-reached"`` \| ``"capture/invalid-photo-codec"`` \| ``"capture/not-bound-error"`` \| ``"capture/capture-type-not-supported"`` \| ``"capture/video-not-enabled"`` \| ``"capture/photo-not-enabled"`` \| ``"capture/aborted"`` \| ``"capture/unknown"``
#### Defined in
[CameraError.ts:31](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L31)
___
### DeviceError
Ƭ **DeviceError**: ``"device/configuration-error"`` \| ``"device/no-device"`` \| ``"device/invalid-device"`` \| ``"device/torch-unavailable"`` \| ``"device/microphone-unavailable"`` \| ``"device/pixel-format-not-supported"`` \| ``"device/low-light-boost-not-supported"`` \| ``"device/focus-not-supported"`` \| ``"device/camera-not-available-on-simulator"``
#### Defined in
[CameraError.ts:8](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L8)
___
### FormatError
Ƭ **FormatError**: ``"format/invalid-fps"`` \| ``"format/invalid-hdr"`` \| ``"format/invalid-low-light-boost"`` \| ``"format/invalid-format"`` \| ``"format/invalid-color-space"``
#### Defined in
[CameraError.ts:18](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L18)
___
### FrameProcessor
Ƭ **FrameProcessor**: `Object`
#### Type declaration
| Name | Type |
| :------ | :------ |
| `frameProcessor` | (`frame`: `Frame`) => `void` |
| `type` | ``"frame-processor"`` |
#### Defined in
[CameraProps.ts:7](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L7)
___
### LogicalCameraDeviceType
Ƭ **LogicalCameraDeviceType**: ``"dual-camera"`` \| ``"dual-wide-camera"`` \| ``"triple-camera"``
Indentifiers for a logical camera (Combinations of multiple physical cameras to create a single logical camera).
* `"dual-camera"`: A combination of wide-angle and telephoto cameras that creates a capture device.
* `"dual-wide-camera"`: A device that consists of two cameras of fixed focal length, one ultrawide angle and one wide angle.
* `"triple-camera"`: A device that consists of three cameras of fixed focal length, one ultrawide angle, one wide angle, and one telephoto.
#### Defined in
[CameraDevice.ts:21](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L21)
___
### ParameterError
Ƭ **ParameterError**: ``"parameter/invalid-parameter"`` \| ``"parameter/unsupported-os"`` \| ``"parameter/unsupported-output"`` \| ``"parameter/unsupported-input"`` \| ``"parameter/invalid-combination"``
#### Defined in
[CameraError.ts:2](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L2)
___
### PermissionError
Ƭ **PermissionError**: ``"permission/microphone-permission-denied"`` \| ``"permission/camera-permission-denied"``
#### Defined in
[CameraError.ts:1](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L1)
___
### PhysicalCameraDeviceType
Ƭ **PhysicalCameraDeviceType**: ``"ultra-wide-angle-camera"`` \| ``"wide-angle-camera"`` \| ``"telephoto-camera"``
Indentifiers for a physical camera (one that actually exists on the back/front of the device)
* `"ultra-wide-angle-camera"`: A built-in camera with a shorter focal length than that of a wide-angle camera. (focal length between below 24mm)
* `"wide-angle-camera"`: A built-in wide-angle camera. (focal length between 24mm and 35mm)
* `"telephoto-camera"`: A built-in camera device with a longer focal length than a wide-angle camera. (focal length between above 85mm)
#### Defined in
[CameraDevice.ts:12](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L12)
___
### SessionError
Ƭ **SessionError**: ``"session/camera-not-ready"`` \| ``"session/camera-cannot-be-opened"`` \| ``"session/camera-has-been-disconnected"`` \| ``"session/audio-session-setup-failed"`` \| ``"session/audio-in-use-by-other-app"`` \| ``"session/audio-session-failed-to-activate"``
#### Defined in
[CameraError.ts:24](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L24)
___
### SystemError
Ƭ **SystemError**: ``"system/camera-module-not-found"`` \| ``"system/no-camera-manager"`` \| ``"system/frame-processors-unavailable"`` \| ``"system/view-not-found"``
#### Defined in
[CameraError.ts:53](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L53)
___
### UnknownError
Ƭ **UnknownError**: ``"unknown/unknown"``
#### Defined in
[CameraError.ts:58](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L58)
___
### VideoStabilizationMode
Ƭ **VideoStabilizationMode**: ``"off"`` \| ``"standard"`` \| ``"cinematic"`` \| ``"cinematic-extended"`` \| ``"auto"``
Indicates a format's supported video stabilization mode. Enabling video stabilization may introduce additional latency into the video capture pipeline.
* `"off"`: No video stabilization. Indicates that video should not be stabilized
* `"standard"`: Standard software-based video stabilization. Standard video stabilization reduces the field of view by about 10%.
* `"cinematic"`: Advanced software-based video stabilization. This applies more aggressive cropping or transformations than standard.
* `"cinematic-extended"`: Extended software- and hardware-based stabilization that aggressively crops and transforms the video to apply a smooth cinematic stabilization.
* `"auto"`: Indicates that the most appropriate video stabilization mode for the device and format should be chosen automatically
#### Defined in
[CameraDevice.ts:64](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L64)
## Variables
### VisionCameraProxy
`Const` **VisionCameraProxy**: `TVisionCameraProxy` = `proxy`
#### Defined in
[FrameProcessorPlugins.ts:95](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/FrameProcessorPlugins.ts#L95)
## Functions
### createFrameProcessor
**createFrameProcessor**(`frameProcessor`, `type`): [`FrameProcessor`](#frameprocessor)
Create a new Frame Processor function which you can pass to the `<Camera>`.
(See ["Frame Processors"](https://mrousavy.github.io/react-native-vision-camera/docs/guides/frame-processors))
Make sure to add the `'worklet'` directive to the top of the Frame Processor function, otherwise it will not get compiled into a worklet.
Also make sure to memoize the returned object, so that the Camera doesn't reset the Frame Processor Context each time.
#### Parameters
| Name | Type |
| :------ | :------ |
| `frameProcessor` | (`frame`: `Frame`) => `void` |
| `type` | ``"frame-processor"`` |
#### Returns
[`FrameProcessor`](#frameprocessor)
#### Defined in
[hooks/useFrameProcessor.ts:13](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/hooks/useFrameProcessor.ts#L13)
___
### isErrorWithCause
**isErrorWithCause**(`error`): error is ErrorWithCause
Checks if the given `error` is of type [`ErrorWithCause`](interfaces/ErrorWithCause.md)
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `error` | `unknown` | Any unknown object to validate |
#### Returns
error is ErrorWithCause
`true` if the given `error` is of type [`ErrorWithCause`](interfaces/ErrorWithCause.md)
#### Defined in
[CameraError.ts:176](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L176)
___
### parsePhysicalDeviceTypes
**parsePhysicalDeviceTypes**(`physicalDeviceTypes`): [`PhysicalCameraDeviceType`](#physicalcameradevicetype) \| [`LogicalCameraDeviceType`](#logicalcameradevicetype)
Parses an array of physical device types into a single [`PhysicalCameraDeviceType`](#physicalcameradevicetype) or [`LogicalCameraDeviceType`](#logicalcameradevicetype), depending what matches.
**`Method`**
#### Parameters
| Name | Type |
| :------ | :------ |
| `physicalDeviceTypes` | [`PhysicalCameraDeviceType`](#physicalcameradevicetype)[] |
#### Returns
[`PhysicalCameraDeviceType`](#physicalcameradevicetype) \| [`LogicalCameraDeviceType`](#logicalcameradevicetype)
#### Defined in
[CameraDevice.ts:27](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L27)
___
### runAsync
**runAsync**(`frame`, `func`): `void`
Runs the given function asynchronously, while keeping a strong reference to the Frame.
For example, if you want to run a heavy face detection algorithm
while still drawing to the screen at 60 FPS, you can use `runAsync(...)`
to offload the face detection algorithm to a separate thread.
**`Example`**
```ts
const frameProcessor = useFrameProcessor((frame) => {
'worklet'
console.log('New Frame')
runAsync(frame, () => {
'worklet'
const faces = detectFaces(frame)
const face = [faces0]
console.log(`Detected a new face: ${face}`)
})
})
```
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `frame` | `Frame` | The current Frame of the Frame Processor. |
| `func` | () => `void` | The function to execute. |
#### Returns
`void`
#### Defined in
[FrameProcessorPlugins.ts:177](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/FrameProcessorPlugins.ts#L177)
___
### runAtTargetFps
**runAtTargetFps**<`T`\>(`fps`, `func`): `T` \| `undefined`
Runs the given function at the given target FPS rate.
For example, if you want to run a heavy face detection algorithm
only once per second, you can use `runAtTargetFps(1, ...)` to
throttle it to 1 FPS.
**`Example`**
```ts
const frameProcessor = useFrameProcessor((frame) => {
'worklet'
console.log('New Frame')
runAtTargetFps(5, () => {
'worklet'
const faces = detectFaces(frame)
console.log(`Detected a new face: ${faces[0]}`)
})
})
```
#### Type parameters
| Name |
| :------ |
| `T` |
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `fps` | `number` | The target FPS rate at which the given function should be executed |
| `func` | () => `T` | The function to execute. |
#### Returns
`T` \| `undefined`
The result of the function if it was executed, or `undefined` otherwise.
#### Defined in
[FrameProcessorPlugins.ts:136](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/FrameProcessorPlugins.ts#L136)
___
### sortDevices
**sortDevices**(`left`, `right`): `number`
Compares two devices by the following criteria:
* `wide-angle-camera`s are ranked higher than others
* Devices with more physical cameras are ranked higher than ones with less. (e.g. "Triple Camera" > "Wide-Angle Camera")
> Note that this makes the `sort()` function descending, so the first element (`[0]`) is the "best" device.
**`Example`**
```ts
const devices = camera.devices.sort(sortDevices)
const bestDevice = devices[0]
```
**`Method`**
#### Parameters
| Name | Type |
| :------ | :------ |
| `left` | [`CameraDevice`](interfaces/CameraDevice.md) |
| `right` | [`CameraDevice`](interfaces/CameraDevice.md) |
#### Returns
`number`
#### Defined in
[utils/FormatFilter.ts:18](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/utils/FormatFilter.ts#L18)
___
### sortFormats
**sortFormats**(`left`, `right`): `number`
Sort formats by resolution and aspect ratio difference (to the Screen size).
> Note that this makes the `sort()` function descending, so the first element (`[0]`) is the "best" device.
#### Parameters
| Name | Type |
| :------ | :------ |
| `left` | [`CameraDeviceFormat`](interfaces/CameraDeviceFormat.md) |
| `right` | [`CameraDeviceFormat`](interfaces/CameraDeviceFormat.md) |
#### Returns
`number`
#### Defined in
[utils/FormatFilter.ts:72](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/utils/FormatFilter.ts#L72)
___
### tryParseNativeCameraError
**tryParseNativeCameraError**<`T`\>(`nativeError`): [`CameraCaptureError`](classes/CameraCaptureError.md) \| [`CameraRuntimeError`](classes/CameraRuntimeError.md) \| `T`
Tries to parse an error coming from native to a typed JS camera error.
**`Method`**
#### Type parameters
| Name |
| :------ |
| `T` |
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `nativeError` | `T` | The native error instance. This is a JSON in the legacy native module architecture. |
#### Returns
[`CameraCaptureError`](classes/CameraCaptureError.md) \| [`CameraRuntimeError`](classes/CameraRuntimeError.md) \| `T`
A [`CameraRuntimeError`](classes/CameraRuntimeError.md) or [`CameraCaptureError`](classes/CameraCaptureError.md), or the `nativeError` itself if it's not parsable
#### Defined in
[CameraError.ts:202](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L202)
___
### useCameraDevices
**useCameraDevices**(): [`CameraDevices`](#cameradevices)
Gets the best available [`CameraDevice`](interfaces/CameraDevice.md). Devices with more cameras are preferred.
**`Throws`**
[`CameraRuntimeError`](classes/CameraRuntimeError.md) if no device was found.
**`Example`**
```tsx
const device = useCameraDevice()
// ...
return <Camera device={device} />
```
#### Returns
[`CameraDevices`](#cameradevices)
The best matching [`CameraDevice`](interfaces/CameraDevice.md).
#### Defined in
[hooks/useCameraDevices.ts:29](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/hooks/useCameraDevices.ts#L29)
**useCameraDevices**(`deviceType`): [`CameraDevices`](#cameradevices)
Gets a [`CameraDevice`](interfaces/CameraDevice.md) for the requested device type.
**`Throws`**
[`CameraRuntimeError`](classes/CameraRuntimeError.md) if no device was found.
**`Example`**
```tsx
const device = useCameraDevice('wide-angle-camera')
// ...
return <Camera device={device} />
```
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `deviceType` | [`PhysicalCameraDeviceType`](#physicalcameradevicetype) \| [`LogicalCameraDeviceType`](#logicalcameradevicetype) | Specifies a device type which will be used as a device filter. |
#### Returns
[`CameraDevices`](#cameradevices)
A [`CameraDevice`](interfaces/CameraDevice.md) for the requested device type.
#### Defined in
[hooks/useCameraDevices.ts:44](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/hooks/useCameraDevices.ts#L44)
___
### useCameraFormat
**useCameraFormat**(`device?`): [`CameraDeviceFormat`](interfaces/CameraDeviceFormat.md) \| `undefined`
Returns the best format for the given camera device.
This function tries to choose a format with the highest possible photo-capture resolution and best matching aspect ratio.
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `device?` | [`CameraDevice`](interfaces/CameraDevice.md) | The Camera Device |
#### Returns
[`CameraDeviceFormat`](interfaces/CameraDeviceFormat.md) \| `undefined`
The best matching format for the given camera device, or `undefined` if the camera device is `undefined`.
#### Defined in
[hooks/useCameraFormat.ts:14](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/hooks/useCameraFormat.ts#L14)
___
### useFrameProcessor
**useFrameProcessor**(`frameProcessor`, `dependencies`): [`FrameProcessor`](#frameprocessor)
Returns a memoized Frame Processor function wich you can pass to the `<Camera>`.
(See ["Frame Processors"](https://mrousavy.github.io/react-native-vision-camera/docs/guides/frame-processors))
Make sure to add the `'worklet'` directive to the top of the Frame Processor function, otherwise it will not get compiled into a worklet.
**`Example`**
```ts
const frameProcessor = useFrameProcessor((frame) => {
'worklet'
const qrCodes = scanQRCodes(frame)
console.log(`QR Codes: ${qrCodes}`)
}, [])
```
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `frameProcessor` | (`frame`: `Frame`) => `void` | The Frame Processor |
| `dependencies` | `DependencyList` | The React dependencies which will be copied into the VisionCamera JS-Runtime. |
#### Returns
[`FrameProcessor`](#frameprocessor)
The memoized Frame Processor.
#### Defined in
[hooks/useFrameProcessor.ts:49](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/hooks/useFrameProcessor.ts#L49)

View File

@ -0,0 +1,246 @@
---
id: "CameraDevice"
title: "CameraDevice"
sidebar_position: 0
custom_edit_url: null
---
Represents a camera device discovered by the [`Camera.getAvailableCameraDevices()`](../classes/Camera.md#getavailablecameradevices) function
## Properties
### devices
**devices**: [`PhysicalCameraDeviceType`](../#physicalcameradevicetype)[]
The physical devices this `CameraDevice` contains.
* If this camera device is a **logical camera** (combination of multiple physical cameras), there are multiple cameras in this array.
* If this camera device is a **physical camera**, there is only a single element in this array.
You can check if the camera is a logical multi-camera by using the `isMultiCam` property.
#### Defined in
[CameraDevice.ts:149](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L149)
___
### formats
**formats**: [`CameraDeviceFormat`](CameraDeviceFormat.md)[]
All available formats for this camera device. Use this to find the best format for your use case and set it to the Camera's [`Camera's .format`](CameraProps.md#format) property.
See [the Camera Formats documentation](https://react-native-vision-camera.com/docs/guides/formats) for more information about Camera Formats.
#### Defined in
[CameraDevice.ts:203](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L203)
___
### hardwareLevel
**hardwareLevel**: ``"legacy"`` \| ``"limited"`` \| ``"full"``
The hardware level of the Camera.
- On Android, some older devices are running at a `legacy` or `limited` level which means they are running in a backwards compatible mode.
- On iOS, all devices are `full`.
#### Defined in
[CameraDevice.ts:229](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L229)
___
### hasFlash
**hasFlash**: `boolean`
Specifies whether this camera supports enabling flash for photo capture.
#### Defined in
[CameraDevice.ts:161](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L161)
___
### hasTorch
**hasTorch**: `boolean`
Specifies whether this camera supports continuously enabling the flash to act like a torch (flash with video capture)
#### Defined in
[CameraDevice.ts:165](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L165)
___
### id
**id**: `string`
The native ID of the camera device instance.
#### Defined in
[CameraDevice.ts:140](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L140)
___
### isMultiCam
**isMultiCam**: `boolean`
A property indicating whether the device is a virtual multi-camera consisting of multiple combined physical cameras.
Examples:
* The Dual Camera, which supports seamlessly switching between a wide and telephoto camera while zooming and generating depth data from the disparities between the different points of view of the physical cameras.
* The TrueDepth Camera, which generates depth data from disparities between a YUV camera and an Infrared camera pointed in the same direction.
#### Defined in
[CameraDevice.ts:173](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L173)
___
### maxZoom
**maxZoom**: `number`
Maximum available zoom factor (e.g. `128`)
#### Defined in
[CameraDevice.ts:181](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L181)
___
### minZoom
**minZoom**: `number`
Minimum available zoom factor (e.g. `1`)
#### Defined in
[CameraDevice.ts:177](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L177)
___
### name
**name**: `string`
A friendly localized name describing the camera.
#### Defined in
[CameraDevice.ts:157](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L157)
___
### neutralZoom
**neutralZoom**: `number`
The zoom factor where the camera is "neutral".
* For single-physical cameras this property is always `1.0`.
* For multi cameras this property is a value between `minZoom` and `maxZoom`, where the camera is in _wide-angle_ mode and hasn't switched to the _ultra-wide-angle_ ("fish-eye") or telephoto camera yet.
Use this value as an initial value for the zoom property if you implement custom zoom. (e.g. reanimated shared value should be initially set to this value)
**`Example`**
```ts
const device = ...
const zoom = useSharedValue(device.neutralZoom) // <-- initial value so it doesn't start at ultra-wide
const cameraProps = useAnimatedProps(() => ({
zoom: zoom.value
}))
```
#### Defined in
[CameraDevice.ts:197](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L197)
___
### position
**position**: [`CameraPosition`](../#cameraposition)
Specifies the physical position of this camera. (back or front)
#### Defined in
[CameraDevice.ts:153](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L153)
___
### sensorOrientation
**sensorOrientation**: `Orientation`
Represents the sensor's orientation relative to the phone.
For most phones this will be landscape, as Camera sensors are usually always rotated by 90 degrees (i.e. width and height are flipped).
#### Defined in
[CameraDevice.ts:234](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L234)
___
### supportsDepthCapture
**supportsDepthCapture**: `boolean`
Whether this camera supports taking photos with depth data.
**! Work in Progress !**
#### Defined in
[CameraDevice.ts:213](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L213)
___
### supportsFocus
**supportsFocus**: `boolean`
Specifies whether this device supports focusing ([`Camera.focus(...)`](../classes/Camera.md#focus))
#### Defined in
[CameraDevice.ts:223](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L223)
___
### supportsLowLightBoost
**supportsLowLightBoost**: `boolean`
Whether this camera device supports low light boost.
#### Defined in
[CameraDevice.ts:207](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L207)
___
### supportsRawCapture
**supportsRawCapture**: `boolean`
Whether this camera supports taking photos in RAW format
**! Work in Progress !**
#### Defined in
[CameraDevice.ts:219](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L219)

View File

@ -0,0 +1,189 @@
---
id: "CameraDeviceFormat"
title: "CameraDeviceFormat"
sidebar_position: 0
custom_edit_url: null
---
A Camera Device's video format. Do not create instances of this type yourself, only use [`Camera.getAvailableCameraDevices()`](../classes/Camera.md#getavailablecameradevices).
## Properties
### autoFocusSystem
**autoFocusSystem**: [`AutoFocusSystem`](../#autofocussystem)
Specifies this format's auto focus system.
#### Defined in
[CameraDevice.ts:121](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L121)
___
### fieldOfView
**fieldOfView**: `number`
The video field of view in degrees
#### Defined in
[CameraDevice.ts:97](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L97)
___
### maxFps
**maxFps**: `number`
The maximum frame rate this Format is able to run at. High resolution formats often run at lower frame rates.
#### Defined in
[CameraDevice.ts:117](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L117)
___
### maxISO
**maxISO**: `number`
Maximum supported ISO value
#### Defined in
[CameraDevice.ts:89](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L89)
___
### maxZoom
**maxZoom**: `number`
The maximum zoom factor (e.g. `128`)
#### Defined in
[CameraDevice.ts:101](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L101)
___
### minFps
**minFps**: `number`
The minum frame rate this Format needs to run at. High resolution formats often run at lower frame rates.
#### Defined in
[CameraDevice.ts:113](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L113)
___
### minISO
**minISO**: `number`
Minimum supported ISO value
#### Defined in
[CameraDevice.ts:93](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L93)
___
### photoHeight
**photoHeight**: `number`
The height of the highest resolution a still image (photo) can be produced in
#### Defined in
[CameraDevice.ts:73](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L73)
___
### photoWidth
**photoWidth**: `number`
The width of the highest resolution a still image (photo) can be produced in
#### Defined in
[CameraDevice.ts:77](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L77)
___
### pixelFormats
**pixelFormats**: `PixelFormat`[]
Specifies this format's supported pixel-formats.
In most cases, this is `['native', 'yuv']`.
#### Defined in
[CameraDevice.ts:130](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L130)
___
### supportsPhotoHDR
**supportsPhotoHDR**: `boolean`
Specifies whether this format supports HDR mode for photo capture
#### Defined in
[CameraDevice.ts:109](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L109)
___
### supportsVideoHDR
**supportsVideoHDR**: `boolean`
Specifies whether this format supports HDR mode for video capture
#### Defined in
[CameraDevice.ts:105](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L105)
___
### videoHeight
**videoHeight**: `number`
The video resolutions's height
#### Defined in
[CameraDevice.ts:81](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L81)
___
### videoStabilizationModes
**videoStabilizationModes**: [`VideoStabilizationMode`](../#videostabilizationmode)[]
All supported video stabilization modes
#### Defined in
[CameraDevice.ts:125](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L125)
___
### videoWidth
**videoWidth**: `number`
The video resolution's width
#### Defined in
[CameraDevice.ts:85](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraDevice.ts#L85)

View File

@ -0,0 +1,406 @@
---
id: "CameraProps"
title: "CameraProps"
sidebar_position: 0
custom_edit_url: null
---
## Hierarchy
- `ViewProps`
**`CameraProps`**
## Properties
### audio
`Optional` **audio**: `boolean`
Enables **audio capture** for video recordings (see ["Recording Videos"](https://react-native-vision-camera.com/docs/guides/capturing/#recording-videos))
#### Defined in
[CameraProps.ts:61](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L61)
___
### device
**device**: [`CameraDevice`](CameraDevice.md)
The Camera Device to use.
See the [Camera Devices](https://react-native-vision-camera.com/docs/guides/devices) section in the documentation for more information about Camera Devices.
**`Example`**
```tsx
const devices = useCameraDevices('wide-angle-camera')
const device = devices.back
return (
<Camera
device={device}
isActive={true}
style={StyleSheet.absoluteFill}
/>
)
```
#### Defined in
[CameraProps.ts:37](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L37)
___
### enableDepthData
`Optional` **enableDepthData**: `boolean`
Also captures data from depth-perception sensors. (e.g. disparity maps)
**`Default`**
false
#### Defined in
[CameraProps.ts:145](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L145)
___
### enableFpsGraph
`Optional` **enableFpsGraph**: `boolean`
If `true`, show a debug view to display the FPS of the Camera session.
This is useful for debugging your Frame Processor's speed.
**`Default`**
false
#### Defined in
[CameraProps.ts:173](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L173)
___
### enableHighQualityPhotos
`Optional` **enableHighQualityPhotos**: `boolean`
Indicates whether the Camera should prepare the photo pipeline to provide maximum quality photos.
This enables:
* High Resolution Capture ([`isHighResolutionCaptureEnabled`](https://developer.apple.com/documentation/avfoundation/avcapturephotooutput/1648721-ishighresolutioncaptureenabled))
* Virtual Device fusion for greater detail ([`isVirtualDeviceConstituentPhotoDeliveryEnabled`](https://developer.apple.com/documentation/avfoundation/avcapturephotooutput/3192189-isvirtualdeviceconstituentphotod))
* Dual Device fusion for greater detail ([`isDualCameraDualPhotoDeliveryEnabled`](https://developer.apple.com/documentation/avfoundation/avcapturephotosettings/2873917-isdualcameradualphotodeliveryena))
* Sets the maximum quality prioritization to `.quality` ([`maxPhotoQualityPrioritization`](https://developer.apple.com/documentation/avfoundation/avcapturephotooutput/3182995-maxphotoqualityprioritization))
**`Default`**
false
#### Defined in
[CameraProps.ts:166](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L166)
___
### enablePortraitEffectsMatteDelivery
`Optional` **enablePortraitEffectsMatteDelivery**: `boolean`
A boolean specifying whether the photo render pipeline is prepared for portrait effects matte delivery.
When enabling this, you must also set `enableDepthData` to `true`.
**`Platform`**
iOS 12.0+
**`Default`**
false
#### Defined in
[CameraProps.ts:154](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L154)
___
### enableZoomGesture
`Optional` **enableZoomGesture**: `boolean`
Enables or disables the native pinch to zoom gesture.
If you want to implement a custom zoom gesture, see [the Zooming with Reanimated documentation](https://react-native-vision-camera.com/docs/guides/animated).
**`Default`**
false
#### Defined in
[CameraProps.ts:106](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L106)
___
### format
`Optional` **format**: [`CameraDeviceFormat`](CameraDeviceFormat.md)
Selects a given format. By default, the best matching format is chosen.
#### Defined in
[CameraProps.ts:113](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L113)
___
### fps
`Optional` **fps**: `number`
Specify the frames per second this camera should use. Make sure the given `format` includes a frame rate range with the given `fps`.
Requires `format` to be set.
#### Defined in
[CameraProps.ts:119](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L119)
___
### frameProcessor
`Optional` **frameProcessor**: [`FrameProcessor`](../#frameprocessor)
A worklet which will be called for every frame the Camera "sees".
> See [the Frame Processors documentation](https://mrousavy.github.io/react-native-vision-camera/docs/guides/frame-processors) for more information
**`Example`**
```tsx
const frameProcessor = useFrameProcessor((frame) => {
'worklet'
const qrCodes = scanQRCodes(frame)
console.log(`Detected QR Codes: ${qrCodes}`)
}, [])
return <Camera {...cameraProps} frameProcessor={frameProcessor} />
```
#### Defined in
[CameraProps.ts:204](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L204)
___
### hdr
`Optional` **hdr**: `boolean`
Enables or disables HDR on this camera device. Make sure the given `format` supports HDR mode.
Requires `format` to be set.
#### Defined in
[CameraProps.ts:125](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L125)
___
### isActive
**isActive**: `boolean`
Whether the Camera should actively stream video frames, or not. See the [documentation about the `isActive` prop](https://react-native-vision-camera.com/docs/guides/lifecycle#the-isactive-prop) for more information.
This can be compared to a Video component, where `isActive` specifies whether the video is paused or not.
> Note: If you fully unmount the `<Camera>` component instead of using `isActive={false}`, the Camera will take a bit longer to start again. In return, it will use less resources since the Camera will be completely destroyed when unmounted.
#### Defined in
[CameraProps.ts:45](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L45)
___
### lowLightBoost
`Optional` **lowLightBoost**: `boolean`
Enables or disables low-light boost on this camera device. Make sure the given `format` supports low-light boost.
Requires `format` to be set.
#### Defined in
[CameraProps.ts:131](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L131)
___
### onError
`Optional` **onError**: (`error`: [`CameraRuntimeError`](../classes/CameraRuntimeError.md)) => `void`
#### Type declaration
▸ (`error`): `void`
Called when any kind of runtime error occured.
##### Parameters
| Name | Type |
| :------ | :------ |
| `error` | [`CameraRuntimeError`](../classes/CameraRuntimeError.md) |
##### Returns
`void`
#### Defined in
[CameraProps.ts:183](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L183)
___
### onInitialized
`Optional` **onInitialized**: () => `void`
#### Type declaration
▸ (): `void`
Called when the camera was successfully initialized.
##### Returns
`void`
#### Defined in
[CameraProps.ts:187](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L187)
___
### orientation
`Optional` **orientation**: `Orientation`
Represents the orientation of all Camera Outputs (Photo, Video, and Frame Processor). If this value is not set, the device orientation is used.
#### Defined in
[CameraProps.ts:177](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L177)
___
### photo
`Optional` **photo**: `boolean`
Enables **photo capture** with the `takePhoto` function (see ["Taking Photos"](https://react-native-vision-camera.com/docs/guides/capturing#taking-photos))
#### Defined in
[CameraProps.ts:51](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L51)
___
### pixelFormat
`Optional` **pixelFormat**: ``"yuv"`` \| ``"rgb"`` \| ``"native"``
Specifies the pixel format for the video pipeline.
Frames from a [Frame Processor](https://mrousavy.github.io/react-native-vision-camera/docs/guides/frame-processors) will be streamed in the pixel format specified here.
While `native` and `yuv` are the most efficient formats, some ML models (such as MLKit Barcode detection) require input Frames to be in RGB colorspace, otherwise they just output nonsense.
- `native`: The hardware native GPU buffer format. This is the most efficient format. (`PRIVATE` on Android, sometimes YUV on iOS)
- `yuv`: The YUV (Y'CbCr 4:2:0 or NV21, 8-bit) format, either video- or full-range, depending on hardware capabilities. This is the second most efficient format.
- `rgb`: The RGB (RGB, RGBA or ABGRA, 8-bit) format. This is least efficient and requires explicit conversion.
**`Default`**
`native`
#### Defined in
[CameraProps.ts:75](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L75)
___
### torch
`Optional` **torch**: ``"off"`` \| ``"on"``
Set the current torch mode.
Note: The torch is only available on `"back"` cameras, and isn't supported by every phone.
**`Default`**
"off"
#### Defined in
[CameraProps.ts:86](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L86)
___
### video
`Optional` **video**: `boolean`
Enables **video capture** with the `startRecording` function (see ["Recording Videos"](https://react-native-vision-camera.com/docs/guides/capturing/#recording-videos))
Note: If both the `photo` and `video` properties are enabled at the same time and the device is running at a `hardwareLevel` of `'legacy'` or `'limited'`, VisionCamera _might_ use a lower resolution for video capture due to hardware constraints.
#### Defined in
[CameraProps.ts:57](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L57)
___
### videoStabilizationMode
`Optional` **videoStabilizationMode**: [`VideoStabilizationMode`](../#videostabilizationmode)
Specifies the video stabilization mode to use.
Requires a `format` to be set that contains the given `videoStabilizationMode`.
#### Defined in
[CameraProps.ts:137](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L137)
___
### zoom
`Optional` **zoom**: `number`
Specifies the zoom factor of the current camera, in "factor"/scale.
This value ranges from `minZoom` (e.g. `1`) to `maxZoom` (e.g. `128`). It is recommended to set this value
to the CameraDevice's `neutralZoom` per default and let the user zoom out to the fish-eye (ultra-wide) camera
on demand (if available)
**Note:** Linearly increasing this value always appears logarithmic to the user.
**`Default`**
1.0
#### Defined in
[CameraProps.ts:98](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraProps.ts#L98)

View File

@ -0,0 +1,98 @@
---
id: "ErrorWithCause"
title: "ErrorWithCause"
sidebar_position: 0
custom_edit_url: null
---
Represents a JSON-style error cause. This contains native `NSError`/`Throwable` information, and can have recursive [`.cause`](ErrorWithCause.md#cause) properties until the ultimate cause has been found.
## Properties
### cause
`Optional` **cause**: [`ErrorWithCause`](ErrorWithCause.md)
Optional additional cause for nested errors
* iOS: N/A
* Android: `Throwable.cause`
#### Defined in
[CameraError.ts:105](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L105)
___
### code
`Optional` **code**: `number`
The native error's code.
* iOS: `NSError.code`
* Android: N/A
#### Defined in
[CameraError.ts:70](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L70)
___
### details
`Optional` **details**: `Record`<`string`, `unknown`\>
Optional additional details
* iOS: `NSError.userInfo`
* Android: N/A
#### Defined in
[CameraError.ts:91](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L91)
___
### domain
`Optional` **domain**: `string`
The native error's domain.
* iOS: `NSError.domain`
* Android: N/A
#### Defined in
[CameraError.ts:77](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L77)
___
### message
**message**: `string`
The native error description
* iOS: `NSError.message`
* Android: `Throwable.message`
#### Defined in
[CameraError.ts:84](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L84)
___
### stacktrace
`Optional` **stacktrace**: `string`
Optional Java stacktrace
* iOS: N/A
* Android: `Throwable.stacktrace.toString()`
#### Defined in
[CameraError.ts:98](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/CameraError.ts#L98)

View File

@ -0,0 +1,118 @@
---
id: "Frame"
title: "Frame"
sidebar_position: 0
custom_edit_url: null
---
A single frame, as seen by the camera.
## Properties
### bytesPerRow
**bytesPerRow**: `number`
Returns the amount of bytes per row.
#### Defined in
[Frame.ts:20](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/Frame.ts#L20)
___
### height
**height**: `number`
Returns the height of the frame, in pixels.
#### Defined in
[Frame.ts:16](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/Frame.ts#L16)
___
### isValid
**isValid**: `boolean`
Whether the underlying buffer is still valid or not. The buffer will be released after the frame processor returns, or `close()` is called.
#### Defined in
[Frame.ts:8](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/Frame.ts#L8)
___
### planesCount
**planesCount**: `number`
Returns the number of planes this frame contains.
#### Defined in
[Frame.ts:24](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/Frame.ts#L24)
___
### width
**width**: `number`
Returns the width of the frame, in pixels.
#### Defined in
[Frame.ts:12](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/Frame.ts#L12)
## Methods
### close
**close**(): `void`
Closes and disposes the Frame.
Only close frames that you have created yourself, e.g. by copying the frame you receive in a frame processor.
**`Example`**
```ts
const frameProcessor = useFrameProcessor((frame) => {
const smallerCopy = resize(frame, 480, 270)
// run AI ...
smallerCopy.close()
// don't close `frame`!
})
```
#### Returns
`void`
#### Defined in
[Frame.ts:48](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/Frame.ts#L48)
___
### toString
**toString**(): `string`
Returns a string representation of the frame.
**`Example`**
```ts
console.log(frame.toString()) // -> "3840 x 2160 Frame"
```
#### Returns
`string`
#### Defined in
[Frame.ts:33](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/Frame.ts#L33)

View File

@ -0,0 +1,26 @@
---
id: "FrameProcessorPerformanceSuggestion"
title: "FrameProcessorPerformanceSuggestion"
sidebar_position: 0
custom_edit_url: null
---
## Properties
### suggestedFrameProcessorFps
**suggestedFrameProcessorFps**: `number`
#### Defined in
[CameraProps.ts:9](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/CameraProps.ts#L9)
___
### type
**type**: ``"can-use-higher-fps"`` \| ``"should-use-lower-fps"``
#### Defined in
[CameraProps.ts:8](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/CameraProps.ts#L8)

View File

@ -0,0 +1,26 @@
---
id: "FrameRateRange"
title: "FrameRateRange"
sidebar_position: 0
custom_edit_url: null
---
## Properties
### maxFrameRate
**maxFrameRate**: `number`
#### Defined in
[CameraDevice.ts:104](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/CameraDevice.ts#L104)
___
### minFrameRate
**minFrameRate**: `number`
#### Defined in
[CameraDevice.ts:103](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/CameraDevice.ts#L103)

View File

@ -0,0 +1,178 @@
---
id: "PhotoFile"
title: "PhotoFile"
sidebar_position: 0
custom_edit_url: null
---
Represents a Photo taken by the Camera written to the local filesystem.
See [`Camera.takePhoto()`](../classes/Camera.md#takephoto)
## Hierarchy
- [`TemporaryFile`](TemporaryFile.md)
**`PhotoFile`**
## Properties
### height
**height**: `number`
The height of the photo, in pixels.
#### Defined in
[PhotoFile.ts:62](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L62)
___
### isMirrored
**isMirrored**: `boolean`
Whether this photo is mirrored (selfies) or not.
#### Defined in
[PhotoFile.ts:76](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L76)
___
### isRawPhoto
**isRawPhoto**: `boolean`
Whether this photo is in RAW format or not.
#### Defined in
[PhotoFile.ts:66](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L66)
___
### metadata
`Optional` **metadata**: `Object`
Metadata information describing the captured image. (iOS only)
**`See`**
[AVCapturePhoto.metadata](https://developer.apple.com/documentation/avfoundation/avcapturephoto/2873982-metadata)
**`Platform`**
iOS
#### Type declaration
| Name | Type | Description |
| :------ | :------ | :------ |
| `DPIHeight` | `number` | **`Platform`** iOS |
| `DPIWidth` | `number` | **`Platform`** iOS |
| `Orientation` | `number` | Orientation of the EXIF Image. * 1 = 0 degrees: the correct orientation, no adjustment is required. * 2 = 0 degrees, mirrored: image has been flipped back-to-front. * 3 = 180 degrees: image is upside down. * 4 = 180 degrees, mirrored: image has been flipped back-to-front and is upside down. * 5 = 90 degrees: image has been flipped back-to-front and is on its side. * 6 = 90 degrees, mirrored: image is on its side. * 7 = 270 degrees: image has been flipped back-to-front and is on its far side. * 8 = 270 degrees, mirrored: image is on its far side. |
| `{Exif}` | { `ApertureValue`: `number` ; `BrightnessValue`: `number` ; `ColorSpace`: `number` ; `DateTimeDigitized`: `string` ; `DateTimeOriginal`: `string` ; `ExifVersion`: `string` ; `ExposureBiasValue`: `number` ; `ExposureMode`: `number` ; `ExposureProgram`: `number` ; `ExposureTime`: `number` ; `FNumber`: `number` ; `Flash`: `number` ; `FocalLenIn35mmFilm`: `number` ; `FocalLength`: `number` ; `ISOSpeedRatings`: `number`[] ; `LensMake`: `string` ; `LensModel`: `string` ; `LensSpecification`: `number`[] ; `MeteringMode`: `number` ; `OffsetTime`: `string` ; `OffsetTimeDigitized`: `string` ; `OffsetTimeOriginal`: `string` ; `PixelXDimension`: `number` ; `PixelYDimension`: `number` ; `SceneType`: `number` ; `SensingMethod`: `number` ; `ShutterSpeedValue`: `number` ; `SubjectArea`: `number`[] ; `SubsecTimeDigitized`: `string` ; `SubsecTimeOriginal`: `string` ; `WhiteBalance`: `number` } | - |
| `{Exif}.ApertureValue` | `number` | - |
| `{Exif}.BrightnessValue` | `number` | - |
| `{Exif}.ColorSpace` | `number` | - |
| `{Exif}.DateTimeDigitized` | `string` | - |
| `{Exif}.DateTimeOriginal` | `string` | - |
| `{Exif}.ExifVersion` | `string` | - |
| `{Exif}.ExposureBiasValue` | `number` | - |
| `{Exif}.ExposureMode` | `number` | - |
| `{Exif}.ExposureProgram` | `number` | - |
| `{Exif}.ExposureTime` | `number` | - |
| `{Exif}.FNumber` | `number` | - |
| `{Exif}.Flash` | `number` | - |
| `{Exif}.FocalLenIn35mmFilm` | `number` | - |
| `{Exif}.FocalLength` | `number` | - |
| `{Exif}.ISOSpeedRatings` | `number`[] | - |
| `{Exif}.LensMake` | `string` | - |
| `{Exif}.LensModel` | `string` | - |
| `{Exif}.LensSpecification` | `number`[] | - |
| `{Exif}.MeteringMode` | `number` | - |
| `{Exif}.OffsetTime` | `string` | - |
| `{Exif}.OffsetTimeDigitized` | `string` | - |
| `{Exif}.OffsetTimeOriginal` | `string` | - |
| `{Exif}.PixelXDimension` | `number` | - |
| `{Exif}.PixelYDimension` | `number` | - |
| `{Exif}.SceneType` | `number` | - |
| `{Exif}.SensingMethod` | `number` | - |
| `{Exif}.ShutterSpeedValue` | `number` | - |
| `{Exif}.SubjectArea` | `number`[] | - |
| `{Exif}.SubsecTimeDigitized` | `string` | - |
| `{Exif}.SubsecTimeOriginal` | `string` | - |
| `{Exif}.WhiteBalance` | `number` | - |
| `{MakerApple}?` | `Record`<`string`, `unknown`\> | Represents any data Apple cameras write to the metadata **`Platform`** iOS |
| `{TIFF}` | { `DateTime`: `string` ; `HostComputer?`: `string` ; `Make`: `string` ; `Model`: `string` ; `ResolutionUnit`: `number` ; `Software`: `string` ; `XResolution`: `number` ; `YResolution`: `number` } | - |
| `{TIFF}.DateTime` | `string` | - |
| `{TIFF}.HostComputer?` | `string` | **`Platform`** iOS |
| `{TIFF}.Make` | `string` | - |
| `{TIFF}.Model` | `string` | - |
| `{TIFF}.ResolutionUnit` | `number` | - |
| `{TIFF}.Software` | `string` | - |
| `{TIFF}.XResolution` | `number` | - |
| `{TIFF}.YResolution` | `number` | - |
#### Defined in
[PhotoFile.ts:85](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L85)
___
### orientation
**orientation**: `Orientation`
Display orientation of the photo, relative to the Camera's sensor orientation.
Note that Camera sensors are landscape, so e.g. "portrait" photos will have a value of "landscape-left", etc.
#### Defined in
[PhotoFile.ts:72](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L72)
___
### path
**path**: `string`
The path of the file.
* **Note:** If you want to consume this file (e.g. for displaying it in an `<Image>` component), you might have to add the `file://` prefix.
* **Note:** This file might get deleted once the app closes because it lives in the temp directory.
#### Inherited from
[TemporaryFile](TemporaryFile.md).[path](TemporaryFile.md#path)
#### Defined in
[TemporaryFile.ts:12](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/TemporaryFile.ts#L12)
___
### thumbnail
`Optional` **thumbnail**: `Record`<`string`, `unknown`\>
#### Defined in
[PhotoFile.ts:77](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L77)
___
### width
**width**: `number`
The width of the photo, in pixels.
#### Defined in
[PhotoFile.ts:58](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L58)

View File

@ -0,0 +1,32 @@
---
id: "Point"
title: "Point"
sidebar_position: 0
custom_edit_url: null
---
Represents a Point in a 2 dimensional coordinate system.
## Properties
### x
**x**: `number`
The X coordinate of this Point. (double)
#### Defined in
[Point.ts:8](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Point.ts#L8)
___
### y
**y**: `number`
The Y coordinate of this Point. (double)
#### Defined in
[Point.ts:12](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/Point.ts#L12)

View File

@ -0,0 +1,96 @@
---
id: "RecordVideoOptions"
title: "RecordVideoOptions"
sidebar_position: 0
custom_edit_url: null
---
## Properties
### fileType
`Optional` **fileType**: ``"mov"`` \| ``"mp4"``
Specifies the output file type to record videos into.
#### Defined in
[VideoFile.ts:12](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/VideoFile.ts#L12)
___
### flash
`Optional` **flash**: ``"off"`` \| ``"auto"`` \| ``"on"``
Set the video flash mode. Natively, this just enables the torch while recording.
#### Defined in
[VideoFile.ts:8](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/VideoFile.ts#L8)
___
### onRecordingError
**onRecordingError**: (`error`: [`CameraCaptureError`](../classes/CameraCaptureError.md)) => `void`
#### Type declaration
▸ (`error`): `void`
Called when there was an unexpected runtime error while recording the video.
##### Parameters
| Name | Type |
| :------ | :------ |
| `error` | [`CameraCaptureError`](../classes/CameraCaptureError.md) |
##### Returns
`void`
#### Defined in
[VideoFile.ts:16](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/VideoFile.ts#L16)
___
### onRecordingFinished
**onRecordingFinished**: (`video`: [`VideoFile`](VideoFile.md)) => `void`
#### Type declaration
▸ (`video`): `void`
Called when the recording has been successfully saved to file.
##### Parameters
| Name | Type |
| :------ | :------ |
| `video` | [`VideoFile`](VideoFile.md) |
##### Returns
`void`
#### Defined in
[VideoFile.ts:20](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/VideoFile.ts#L20)
___
### videoCodec
`Optional` **videoCodec**: ``"h265"``
The Video Codec to record in.
- `h264`: Widely supported, but might be less efficient, especially with larger sizes or framerates.
- `h265`: The HEVC (High-Efficient-Video-Codec) for higher efficient video recordings.
#### Defined in
[VideoFile.ts:26](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/VideoFile.ts#L26)

View File

@ -0,0 +1,111 @@
---
id: "TakePhotoOptions"
title: "TakePhotoOptions"
sidebar_position: 0
custom_edit_url: null
---
## Properties
### enableAutoDistortionCorrection
`Optional` **enableAutoDistortionCorrection**: `boolean`
Specifies whether the photo output should use content aware distortion correction on this photo request.
For example, the algorithm may not apply correction to faces in the center of a photo, but may apply it to faces near the photos edges.
**`Platform`**
iOS
**`Default`**
false
#### Defined in
[PhotoFile.ts:40](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L40)
___
### enableAutoRedEyeReduction
`Optional` **enableAutoRedEyeReduction**: `boolean`
Specifies whether red-eye reduction should be applied automatically on flash captures.
**`Default`**
false
#### Defined in
[PhotoFile.ts:26](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L26)
___
### enableAutoStabilization
`Optional` **enableAutoStabilization**: `boolean`
Indicates whether still image stabilization will be employed when capturing the photo
**`Default`**
false
#### Defined in
[PhotoFile.ts:32](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L32)
___
### enableShutterSound
`Optional` **enableShutterSound**: `boolean`
Whether to play the default shutter "click" sound when taking a picture or not.
**`Default`**
true
#### Defined in
[PhotoFile.ts:46](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L46)
___
### flash
`Optional` **flash**: ``"off"`` \| ``"auto"`` \| ``"on"``
Whether the Flash should be enabled or disabled
**`Default`**
"auto"
#### Defined in
[PhotoFile.ts:20](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L20)
___
### qualityPrioritization
`Optional` **qualityPrioritization**: ``"quality"`` \| ``"balanced"`` \| ``"speed"``
Indicates how photo quality should be prioritized against speed.
* `"quality"` Indicates that photo quality is paramount, even at the expense of shot-to-shot time
* `"balanced"` Indicates that photo quality and speed of delivery are balanced in priority
* `"speed"` Indicates that speed of photo delivery is most important, even at the expense of quality
**`Default`**
"balanced"
#### Defined in
[PhotoFile.ts:14](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/PhotoFile.ts#L14)

View File

@ -0,0 +1,62 @@
---
id: "TakeSnapshotOptions"
title: "TakeSnapshotOptions"
sidebar_position: 0
custom_edit_url: null
---
## Properties
### flash
`Optional` **flash**: ``"off"`` \| ``"on"``
Whether the Flash should be enabled or disabled
**`Default`**
"off"
#### Defined in
[Snapshot.ts:16](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/Snapshot.ts#L16)
___
### quality
`Optional` **quality**: `number`
Specifies the quality of the JPEG. (0-100, where 100 means best quality (no compression))
It is recommended to set this to `90` or even `80`, since the user probably won't notice a difference between `90`/`80` and `100`.
**`Default`**
100
#### Defined in
[Snapshot.ts:9](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/Snapshot.ts#L9)
___
### skipMetadata
`Optional` **skipMetadata**: `boolean`
When set to `true`, metadata reading and mapping will be skipped. ([`metadata`](PhotoFile.md#metadata) will be `null`)
This might result in a faster capture, as metadata reading and mapping requires File IO.
**`Default`**
false
**`Platform`**
Android
#### Defined in
[Snapshot.ts:27](https://github.com/mrousavy/react-native-vision-camera/blob/c2fb5bf1/src/Snapshot.ts#L27)

View File

@ -0,0 +1,32 @@
---
id: "TemporaryFile"
title: "TemporaryFile"
sidebar_position: 0
custom_edit_url: null
---
Represents a temporary file in the local filesystem.
## Hierarchy
- **`TemporaryFile`**
↳ [`PhotoFile`](PhotoFile.md)
↳ [`VideoFile`](VideoFile.md)
## Properties
### path
**path**: `string`
The path of the file.
* **Note:** If you want to consume this file (e.g. for displaying it in an `<Image>` component), you might have to add the `file://` prefix.
* **Note:** This file might get deleted once the app closes because it lives in the temp directory.
#### Defined in
[TemporaryFile.ts:12](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/TemporaryFile.ts#L12)

View File

@ -0,0 +1,48 @@
---
id: "VideoFile"
title: "VideoFile"
sidebar_position: 0
custom_edit_url: null
---
Represents a Video taken by the Camera written to the local filesystem.
Related: [`Camera.startRecording()`](../classes/Camera.md#startrecording), [`Camera.stopRecording()`](../classes/Camera.md#stoprecording)
## Hierarchy
- [`TemporaryFile`](TemporaryFile.md)
**`VideoFile`**
## Properties
### duration
**duration**: `number`
Represents the duration of the video, in seconds.
#### Defined in
[VideoFile.ts:38](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/VideoFile.ts#L38)
___
### path
**path**: `string`
The path of the file.
* **Note:** If you want to consume this file (e.g. for displaying it in an `<Image>` component), you might have to add the `file://` prefix.
* **Note:** This file might get deleted once the app closes because it lives in the temp directory.
#### Inherited from
[TemporaryFile](TemporaryFile.md).[path](TemporaryFile.md#path)
#### Defined in
[TemporaryFile.ts:12](https://github.com/mrousavy/react-native-vision-camera/blob/c66550ed/package/src/TemporaryFile.ts#L12)

View File

@ -0,0 +1,2 @@
label: "Interfaces"
position: 4

View File

@ -50,7 +50,7 @@ The `CameraError` type is a baseclass type for all other errors and provides the
* `cause.cause?`: The cause that caused this cause. (Recursive) (Optional)
:::note
See [the `CameraError.ts` file](https://github.com/mrousavy/react-native-vision-camera/blob/main/src/CameraError.ts) for a list of all possible error codes
See [the `CameraError.ts` file](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/src/CameraError.ts) for a list of all possible error codes
:::
### Runtime Errors

View File

@ -203,13 +203,11 @@ If you are using the [react-hooks ESLint plugin](https://www.npmjs.com/package/e
**Frame Processors** are JS functions that will be **workletized** using [react-native-worklets-core](https://github.com/margelo/react-native-worklets-core). They are created on a **parallel camera thread** using a separate JavaScript Runtime (_"VisionCamera JS-Runtime"_) and are **invoked synchronously** (using JSI) without ever going over the bridge. In a **Frame Processor** you can write normal JS code, call back to the React-JS Thread (e.g. `setState`), use [Shared Values](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/shared-values/) and call **Frame Processor Plugins**.
> See [**the example Frame Processor**](https://github.com/mrousavy/react-native-vision-camera/blob/cf68a4c6476d085ec48fc424a53a96962e0c33f9/example/src/CameraPage.tsx#L199-L203)
#### Frame Processor Plugins
**Frame Processor Plugins** are native functions (written in Objective-C, Swift, C++, Java or Kotlin) that are injected into the VisionCamera JS-Runtime. They can be **synchronously called** from your JS Frame Processors (using JSI) without ever going over the bridge. Because VisionCamera provides an easy-to-use plugin API, you can easily create a **Frame Processor Plugin** yourself. Some examples include [Barcode Scanning](https://developers.google.com/ml-kit/vision/barcode-scanning), [Face Detection](https://developers.google.com/ml-kit/vision/face-detection), [Image Labeling](https://developers.google.com/ml-kit/vision/image-labeling), [Text Recognition](https://developers.google.com/ml-kit/vision/text-recognition) and more.
> Learn how to [**create Frame Processor Plugins**](frame-processors-plugins-overview), or check out the [**example Frame Processor Plugin for iOS**](https://github.com/mrousavy/react-native-vision-camera/blob/main/example/ios/Frame%20Processor%20Plugins/Example%20Plugin%20(Swift)/ExamplePluginSwift.swift) or [**Android**](https://github.com/mrousavy/react-native-vision-camera/blob/main/example/android/app/src/main/java/com/mrousavy/camera/example/ExampleFrameProcessorPlugin.java).
> Learn how to [**create Frame Processor Plugins**](frame-processors-plugins-overview), or check out the [**example Frame Processor Plugin for iOS**](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/example/ios/Frame%20Processor%20Plugins/Example%20Plugin%20(Swift)/ExamplePluginSwift.swift) or [**Android**](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/example/android/app/src/main/java/com/mrousavy/camera/example/ExampleFrameProcessorPlugin.java).
#### The `Frame` object

View File

@ -76,7 +76,7 @@ public Object callback(Frame frame, Object[] params) {
}
```
Which returns a [`Frame`](https://github.com/mrousavy/react-native-vision-camera/blob/main/src/Frame.ts) in JS:
Which returns a [`Frame`](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/src/Frame.ts) in JS:
```js
const frameProcessor = useFrameProcessor((frame) => {
@ -192,9 +192,9 @@ Your Frame Processor Plugins have to be fast. Use the FPS Graph (`enableFpsGraph
#### 🚀 Create your first Frame Processor Plugin for [iOS](frame-processors-plugins-ios) or [Android](frame-processors-plugins-android)!
[1]: https://github.com/mrousavy/react-native-vision-camera/blob/main/src/Frame.ts
[2]: https://github.com/mrousavy/react-native-vision-camera/blob/main/ios/Frame%20Processor/Frame.h
[3]: https://github.com/mrousavy/react-native-vision-camera/blob/main/android/src/main/java/com/mrousavy/camera/frameprocessor/Frame.java
[1]: https://github.com/mrousavy/react-native-vision-camera/blob/main/package/src/Frame.ts
[2]: https://github.com/mrousavy/react-native-vision-camera/blob/main/package/ios/Frame%20Processor/Frame.h
[3]: https://github.com/mrousavy/react-native-vision-camera/blob/main/package/android/src/main/java/com/mrousavy/camera/frameprocessor/Frame.java
[4]: https://github.com/facebook/react-native/blob/9a43eac7a32a6ba3164a048960101022a92fcd5a/React/Base/RCTBridgeModule.h#L20-L24
[5]: https://developer.apple.com/documentation/coremedia/cmsamplebuffer
[6]: https://developer.android.com/reference/androidx/camera/core/ImageProxy

View File

@ -72,7 +72,7 @@ public class FaceDetectorFrameProcessorPlugin extends FrameProcessorPlugin {
The Frame Processor Plugin will be exposed to JS through the `VisionCameraProxy` object. In this case, it would be `VisionCameraProxy.getFrameProcessorPlugin("detectFaces")`.
:::
4. **Implement your Frame Processing.** See the [Example Plugin (Java)](https://github.com/mrousavy/react-native-vision-camera/blob/main/example/android/app/src/main/java/com/mrousavy/camera/example/ExampleFrameProcessorPlugin.java) for reference.
4. **Implement your Frame Processing.** See the [Example Plugin (Java)](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/example/android/app/src/main/java/com/mrousavy/camera/example/ExampleFrameProcessorPlugin.java) for reference.
5. Create a new Java file which registers the Frame Processor Plugin in a React Package, for the Face Detector plugin this file will be called `FaceDetectorFrameProcessorPluginPackage.java`:
```java {12}
@ -137,7 +137,7 @@ class FaceDetectorFrameProcessorPlugin: FrameProcessorPlugin() {
The Frame Processor Plugin will be exposed to JS through the `VisionCameraProxy` object. In this case, it would be `VisionCameraProxy.getFrameProcessorPlugin("detectFaces")`.
:::
4. **Implement your Frame Processing.** See the [Example Plugin (Java)](https://github.com/mrousavy/react-native-vision-camera/blob/main/example/android/app/src/main/java/com/mrousavy/camera/example/ExampleFrameProcessorPlugin.java) for reference.
4. **Implement your Frame Processing.** See the [Example Plugin (Java)](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/example/android/app/src/main/java/com/mrousavy/camera/example/ExampleFrameProcessorPlugin.java) for reference.
5. Create a new Kotlin file which registers the Frame Processor Plugin in a React Package, for the Face Detector plugin this file will be called `FaceDetectorFrameProcessorPluginPackage.kt`:
```kotlin {9}

View File

@ -77,7 +77,7 @@ For reference see the [CLI's docs](https://github.com/mateusz1913/vision-camera-
The Frame Processor Plugin will be exposed to JS through the `VisionCameraProxy` object. In this case, it would be `VisionCameraProxy.getFrameProcessorPlugin("detectFaces")`.
:::
4. **Implement your Frame Processing.** See the [Example Plugin (Objective-C)](https://github.com/mrousavy/react-native-vision-camera/blob/main/example/ios/Frame%20Processor%20Plugins/Example%20Plugin%20%28Objective%2DC%29) for reference.
4. **Implement your Frame Processing.** See the [Example Plugin (Objective-C)](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/example/ios/Frame%20Processor%20Plugins/Example%20Plugin%20%28Objective%2DC%29) for reference.
</TabItem>
<TabItem value="swift">
@ -132,7 +132,7 @@ public class FaceDetectorFrameProcessorPlugin: FrameProcessorPlugin {
}
```
7. **Implement your frame processing.** See [Example Plugin (Swift)](https://github.com/mrousavy/react-native-vision-camera/blob/main/example/ios/Frame%20Processor%20Plugins/Example%20Plugin%20%28Swift%29) for reference.
7. **Implement your frame processing.** See [Example Plugin (Swift)](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/example/ios/Frame%20Processor%20Plugins/Example%20Plugin%20%28Swift%29) for reference.
</TabItem>

View File

@ -16,7 +16,7 @@ The Camera's `isActive` property can be used to _pause_ the session (`isActive={
For example, you want to **pause the camera** when the user **navigates to another page** or **minimizes the app** since otherwise the camera continues to run in the background without the user seeing it, causing **significant battery drain**. Also, on iOS a green dot indicates the user that the camera is still active, possibly causing the user to raise privacy concerns. (🔗 See ["About the orange and green indicators in your iPhone status bar"](https://support.apple.com/en-us/HT211876))
This example demonstrates how you could pause the camera stream once the app goes into background using a [custom `useIsAppForeground` hook](https://github.com/mrousavy/react-native-vision-camera/blob/main/example/src/hooks/useIsForeground.ts):
This example demonstrates how you could pause the camera stream once the app goes into background using a [custom `useIsAppForeground` hook](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/example/src/hooks/useIsForeground.ts):
```tsx
function App() {

View File

@ -45,7 +45,7 @@ module.exports = {
inside `vision-camera.e2e.js` export the mocked modules.
In this example, several functions of the modules `Camera` and `sortDevices` are mocked.
Define your mocks following the [original definitions](https://github.com/mrousavy/react-native-vision-camera/tree/main/src).
Define your mocks following the [original definitions](https://github.com/mrousavy/react-native-vision-camera/tree/main/package/src).
```js
// vision-camera.js

View File

@ -69,7 +69,7 @@ Before opening an issue, make sure you try the following:
yarn # or `npm i`
```
4. Make sure you have installed the [Android NDK](https://developer.android.com/ndk).
5. Make sure your minimum SDK version is **21 or higher**, and target SDK version is **33 or higher**. See [the example's `build.gradle`](https://github.com/mrousavy/react-native-vision-camera/blob/main/example/android/build.gradle#L5-L10) for reference.
5. Make sure your minimum SDK version is **21 or higher**, and target SDK version is **33 or higher**. See [the example's `build.gradle`](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/example/android/build.gradle#L5-L10) for reference.
1. Open your `build.gradle`
2. Set `buildToolsVersion` to `33.0.0` or higher
3. Set `compileSdkVersion` to `33` or higher
@ -103,4 +103,4 @@ Before opening an issue, make sure you try the following:
## Issues
If nothing has helped so far, try browsing the [GitHub issues](https://github.com/mrousavy/react-native-vision-camera/issues?q=is%3Aissue). If your issue doesn't exist, [create a new one](https://github.com/mrousavy/react-native-vision-camera/issues/new/choose). Make sure to fill out the template and include as many details as possible. Also try to reproduce the issue in the [example app](https://github.com/mrousavy/react-native-vision-camera/blob/main/example).
If nothing has helped so far, try browsing the [GitHub issues](https://github.com/mrousavy/react-native-vision-camera/issues?q=is%3Aissue). If your issue doesn't exist, [create a new one](https://github.com/mrousavy/react-native-vision-camera/issues/new/choose). Make sure to fill out the template and include as many details as possible. Also try to reproduce the issue in the [example app](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/example).

View File

@ -98,7 +98,7 @@ A Camera's `zoom` property is represented in a **logarithmic scale**. That means
### Pinch-to-zoom
The above example only demonstrates how to animate the `zoom` property. To actually implement pinch-to-zoom or pan-to-zoom, take a look at the [VisionCamera example app](https://github.com/mrousavy/react-native-vision-camera/tree/main/example), the pinch-to-zoom gesture can be found [here](https://github.com/mrousavy/react-native-vision-camera/blob/main/example/src/views/CaptureButton.tsx#L189-L208), and the pan-to-zoom gesture can be found [here](https://github.com/mrousavy/react-native-vision-camera/blob/d8551792e97eaa6fa768f54059ffce054bf748d9/example/src/views/CaptureButton.tsx#L185-L205). They implement a real world use-case, where the maximum zoom value is clamped to a realistic value, and the zoom responds very gracefully by using a logarithmic scale.
The above example only demonstrates how to animate the `zoom` property. To actually implement pinch-to-zoom or pan-to-zoom, take a look at the [VisionCamera example app](https://github.com/mrousavy/react-native-vision-camera/tree/main/example), the pinch-to-zoom gesture can be found [here](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/example/src/views/CaptureButton.tsx#L189-L208), and the pan-to-zoom gesture can be found [here](https://github.com/mrousavy/react-native-vision-camera/blob/d8551792e97eaa6fa768f54059ffce054bf748d9/example/src/views/CaptureButton.tsx#L185-L205). They implement a real world use-case, where the maximum zoom value is clamped to a realistic value, and the zoom responds very gracefully by using a logarithmic scale.
<br />

View File

@ -35,7 +35,7 @@ module.exports = {
position: 'left'
},
{
href: 'https://github.com/mrousavy/react-native-vision-camera/tree/main/example',
href: 'https://github.com/mrousavy/react-native-vision-camera/tree/main/package/example',
label: 'Example App',
position: 'left'
},
@ -62,7 +62,7 @@ module.exports = {
},
{
label: 'Example App',
href: 'https://github.com/mrousavy/react-native-vision-camera/tree/main/example',
href: 'https://github.com/mrousavy/react-native-vision-camera/tree/main/package/example',
},
],
},
@ -156,9 +156,9 @@ module.exports = {
'docusaurus-plugin-typedoc',
{
name: 'VisionCamera',
entryPoints: ['../src'],
exclude: "../src/index.ts",
tsconfig: '../tsconfig.json',
entryPoints: ['../package/src'],
exclude: "../package/src/index.ts",
tsconfig: '../package/tsconfig.json',
watch: process.env.TYPEDOC_WATCH,
excludePrivate: true,
excludeProtected: true,

View File

@ -3,7 +3,6 @@
"version": "0.0.0",
"private": true,
"scripts": {
"postinstall": "yarn install --cwd ..",
"docusaurus": "docusaurus",
"start": "TYPEDOC_WATCH=true docusaurus start",
"build": "docusaurus build",

View File

@ -3155,15 +3155,10 @@ caniuse-api@^3.0.0:
lodash.memoize "^4.1.2"
lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001286:
version "1.0.30001295"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001295.tgz#68a60f8f0664f342b2835c5d8898b4faea7b3d51"
integrity sha512-lSP16vcyC0FEy0R4ECc9duSPoKoZy+YkpGkue9G4D81OfPnliopaZrU10+qtPdT8PbGXad/PNx43TIQrOmJZSQ==
caniuse-lite@^1.0.30001426, caniuse-lite@^1.0.30001449:
version "1.0.30001460"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001460.tgz#31d2e26f0a2309860ed3eff154e03890d9d851a7"
integrity sha512-Bud7abqjvEjipUkpLs4D7gR0l8hBYBHoa+tGtKJHvT2AYzLp1z7EmVkUT4ERpVUfca8S2HGIVs883D8pUH1ZzQ==
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001286, caniuse-lite@^1.0.30001426, caniuse-lite@^1.0.30001449:
version "1.0.30001525"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001525.tgz"
integrity sha512-/3z+wB4icFt3r0USMwxujAqRvaD/B7rvGTsKhbhSQErVrJvkZCLhgNLJxU8MevahQVH6hCU9FsHdNUFbiwmE7Q==
ccount@^1.0.0:
version "1.1.0"

70
package/.gitignore vendored Normal file
View File

@ -0,0 +1,70 @@
# OSX
#
.DS_Store
# XDE
.expo/
# VSCode
jsconfig.json
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# Android/IJ
#
.idea
.gradle
local.properties
android.iml
*.hprof
# Cocoapods
#
example/ios/Pods
# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore
# Expo
.expo/*
# generated by bob
lib/
# we only use yarn
package-lock.json
# TypeDoc/Docusaurus stuff
docs/docs/api
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

Some files were not shown because too many files have changed in this diff Show More