Merge branch 'main' into v3

This commit is contained in:
Marc Rousavy 2023-07-31 18:27:11 +02:00 committed by GitHub
commit 61fd4e0474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 2893 additions and 2303 deletions

View File

@ -47,7 +47,7 @@ body:
description: Please check all the boxes that apply
options:
- label: I am using Expo
- label: I have read the [Troubleshooting Guide](https://mrousavy.github.io/react-native-vision-camera/docs/guides/troubleshooting)
- label: I have read the [Troubleshooting Guide](https://react-native-vision-camera.com/docs/guides/troubleshooting)
required: true
- label: I agree to follow this project's [Code of Conduct](https://github.com/mrousavy/react-native-vision-camera/blob/main/CODE_OF_CONDUCT.md)
required: true

View File

@ -28,7 +28,7 @@ body:
description: Please check all the boxes that apply
options:
- label: I am using Expo
- label: I have read the [Troubleshooting Guide](https://mrousavy.github.io/react-native-vision-camera/docs/guides/troubleshooting)
- label: I have read the [Troubleshooting Guide](https://react-native-vision-camera.com/docs/guides/troubleshooting)
required: true
- label: I agree to follow this project's [Code of Conduct](https://github.com/mrousavy/react-native-vision-camera/blob/main/CODE_OF_CONDUCT.md)
required: true

View File

@ -1,7 +1,7 @@
blank_issues_enabled: false
contact_links:
- name: Troubleshooting Guide
url: https://mrousavy.github.io/react-native-vision-camera/docs/guides/troubleshooting
url: https://react-native-vision-camera.com/docs/guides/troubleshooting
about: Please read the Troubleshooting Guide before opening an issue.
- name: VisionCamera Discussions
url: https://github.com/mrousavy/react-native-vision-camera/discussions

View File

@ -1,96 +0,0 @@
name: Build Documentation
on:
pull_request:
branches:
- main
paths:
- '.github/workflows/build-docs.yml'
- 'docs/**'
- 'src/**'
- '*.json'
- '*.js'
- '*.lock'
push:
branches:
- main
paths:
- '.github/workflows/build-docs.yml'
- 'docs/**'
- 'src/**'
- '*.json'
- '*.js'
- '*.lock'
jobs:
checks:
if: github.event_name != 'push'
name: Build Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Test Docs Build
run: |
yarn install --frozen-lockfile
cd docs
yarn install --frozen-lockfile
yarn build
gh-release:
if: github.event_name != 'pull_request'
name: Deploy Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Add key to allow access to repository
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
echo "${{ secrets.GH_PAGES_DEPLOY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
cat <<EOT >> ~/.ssh/config
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa
EOT
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore node_modules from cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Release to GitHub Pages
env:
USE_SSH: true
GIT_USER: git
CURRENT_BRANCH: main
DEPLOYMENT_BRANCH: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "actions@github.com"
git config --global user.name "gh-actions"
yarn install --frozen-lockfile
cd docs
yarn install --frozen-lockfile
yarn deploy

View File

@ -36,8 +36,8 @@
### Documentation
* [Guides](https://mrousavy.github.io/react-native-vision-camera/docs/guides)
* [API](https://mrousavy.github.io/react-native-vision-camera/docs/api)
* [Guides](https://react-native-vision-camera.com/docs/guides)
* [API](https://react-native-vision-camera.com/docs/api)
* [Example](./example/)
### Features
@ -45,7 +45,7 @@
* Photo, Video and Snapshot capture
* Customizable devices and multi-cameras (smoothly zoom out to "fish-eye" camera)
* Customizable FPS
* [Frame Processors](https://mrousavy.github.io/react-native-vision-camera/docs/guides/frame-processors) (JS worklets to run QR-Code scanning, facial recognition, AI object detection, realtime video chats, ...)
* [Frame Processors](https://react-native-vision-camera.com/docs/guides/frame-processors) (JS worklets to run QR-Code scanning, facial recognition, AI object detection, realtime video chats, ...)
* Smooth zooming (Reanimated)
* Fast pause and resume
* HDR & Night modes
@ -82,4 +82,4 @@ If you're integrating VisionCamera in a production app, consider [funding this p
<br />
#### 🚀 Get started by [setting up permissions](https://mrousavy.github.io/react-native-vision-camera/docs/guides/)!
#### 🚀 Get started by [setting up permissions](https://react-native-vision-camera.com/docs/guides/)!

View File

@ -147,13 +147,13 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.5.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
implementation "androidx.camera:camera-core:1.1.0-beta02"
implementation "androidx.camera:camera-camera2:1.1.0-beta02"
implementation "androidx.camera:camera-lifecycle:1.1.0-beta02"
implementation "androidx.camera:camera-video:1.1.0-beta02"
implementation "androidx.camera:camera-core:1.1.0"
implementation "androidx.camera:camera-camera2:1.1.0"
implementation "androidx.camera:camera-lifecycle:1.1.0"
implementation "androidx.camera:camera-video:1.1.0"
implementation "androidx.camera:camera-view:1.1.0-beta02"
implementation "androidx.camera:camera-extensions:1.1.0-beta02"
implementation "androidx.camera:camera-view:1.1.0"
implementation "androidx.camera:camera-extensions:1.1.0"
implementation "androidx.exifinterface:exifinterface:1.3.3"

View File

@ -40,7 +40,7 @@ class NoCameraDeviceError : CameraError("device", "no-device", "No device was se
class InvalidCameraDeviceError(cause: Throwable) : CameraError("device", "invalid-device", "The given Camera device could not be found for use-case binding!", cause)
class ParallelVideoProcessingNotSupportedError(cause: Throwable) : CameraError("device", "parallel-video-processing-not-supported", "The given LEGACY Camera device does not support parallel " +
"video processing (`video={true}` + `frameProcessor={...}`). Disable either `video` or `frameProcessor`. To find out if a device supports parallel video processing, check the `supportsParallelVideoProcessing` property on the CameraDevice. " +
"See https://mrousavy.github.io/react-native-vision-camera/docs/guides/devices#the-supportsparallelvideoprocessing-prop for more information.", cause)
"See https://react-native-vision-camera.com/docs/guides/devices#the-supportsparallelvideoprocessing-prop for more information.", cause)
class FpsNotContainedInFormatError(fps: Int) : CameraError("format", "invalid-fps", "The given FPS were not valid for the currently selected format. Make sure you select a format which `frameRateRanges` includes $fps FPS!")
class HdrNotContainedInFormatError : CameraError(

View File

@ -16,7 +16,7 @@ public abstract class FrameProcessorPlugin {
* The actual Frame Processor plugin callback. Called for every frame the ImageAnalyzer receives.
* @param frame The Frame from the Camera. Don't call .close() on this, as VisionCamera handles that.
* @return You can return any primitive, map or array you want. See the
* <a href="https://mrousavy.github.io/react-native-vision-camera/docs/guides/frame-processors-plugins-overview#types">Types</a>
* <a href="https://react-native-vision-camera.com/docs/guides/frame-processors-plugins-overview#types">Types</a>
* table for a list of supported types.
*/
@DoNotStrip

View File

@ -26,8 +26,4 @@ This command generates static content into the `build` directory and can be serv
## Deployment
```console
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
```
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
Docs are deployed to https://react-native-vision-camera.com using Next.js/Vercel.

View File

@ -14,7 +14,7 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
The Camera's `isActive` property can be used to _pause_ the session (`isActive={false}`) while still keeping the session "warm". This is more desirable than completely unmounting the camera, since _resuming_ the session (`isActive={true}`) will be **much faster** than re-mounting the camera view.
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 **siginificant 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))
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):

View File

@ -87,7 +87,7 @@ A Camera device has different minimum, maximum and neutral zoom values. Those va
* The `neutralZoom` value is often `1`, but can be larger than `1` for devices with "fish-eye" (ultra-wide-angle) cameras. In those cases, the user expects to be at whatever zoom value `neutralZoom` is (e.g. `2`) per default, and if he tries to zoom out even more, he goes to `minZoom` (`1`), which switches over to the "fish-eye" (ultra-wide-angle) camera as seen in this GIF:
<div align="center">
<img src="https://developer.android.com/images/training/camera/multi-camera-4.gif" width="45%" />
<img src="/img/multi-camera.gif" width="45%" />
</div>
The Camera's `zoom` property expects values to be in the same "factor" scale as the `minZoom`, `neutralZoom` and `maxZoom` values - so if you pass `zoom={device.minZoom}` it is at the minimum available zoom, where as if you pass `zoom={device.maxZoom}` the maximum zoom value possible is zoomed in. It is recommended that you start at `device.neutralZoom` and let the user manually zoom out to the fish-eye camera on demand (if available).

View File

@ -1,16 +1,17 @@
module.exports = {
title: 'VisionCamera',
tagline: '📸 The Camera library that sees the vision.',
url: 'https://mrousavy.github.io',
baseUrl: '/react-native-vision-camera/',
url: 'https://react-native-vision-camera.com',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
favicon: './favicon.ico',
favicon: '/favicon.ico',
organizationName: 'mrousavy',
projectName: 'react-native-vision-camera',
themeConfig: {
algolia: {
apiKey: 'ab7f44570bb62d0e07c0f7d92312ed1a',
appId: 'HBHXBT6T9E',
apiKey: '64bc77eda92b7efcb7003b56815f1113',
indexName: 'react-native-vision-camera',
},
prism: {
@ -87,18 +88,55 @@ module.exports = {
},
{
label: 'Marc\'s Portfolio',
href: 'https://mrousavy.github.io',
href: 'https://mrousavy.com',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Marc Rousavy`,
},
image: 'img/11.png',
metadata: [
{
name: 'keywords',
content: 'documentation, coding, docs, guides, camera, react, native, react-native'
},
{
name: 'og:title',
content: 'VisionCamera Documentation'
},
{
name: 'og:type',
content: 'application'
},
{
name: 'og:description',
content: '📸 The Camera library that sees the vision.'
},
{
name: 'og:image',
content: '/img/11.png'
},
],
announcementBar: {
id: 'support_us',
content:
'<b>I am currently working on <a target="_blank" href="https://github.com/mrousavy/react-native-vision-camera/issues/1376">VisionCamera V3 ✨</a> which brings a lot of new features and a full rewrite on Android. Please consider <a target="_blank" href="https://github.com/sponsors/mrousavy">sponsoring me on GitHub</a> so I can work on this.</b>',
backgroundColor: '#ff5c5c',
textColor: '#ffffff',
isCloseable: false,
},
},
presets: [
[
'@docusaurus/preset-classic',
{
sitemap: {
changefreq: 'weekly',
priority: 1.0,
ignorePatterns: ['/tags/**'],
filename: 'sitemap.xml',
},
docs: {
sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/mrousavy/react-native-vision-camera/edit/main/docs/',
@ -106,6 +144,10 @@ module.exports = {
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
gtag: {
trackingID: 'G-FX9Q0YKV7S',
anonymizeIP: false,
},
},
],
],

View File

@ -3,6 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"postinstall": "yarn install --cwd ..",
"docusaurus": "docusaurus",
"start": "TYPEDOC_WATCH=true docusaurus start",
"build": "docusaurus build",
@ -12,12 +13,15 @@
"clear": "docusaurus clear"
},
"dependencies": {
"@docusaurus/core": "^2.0.0-beta.14",
"@docusaurus/preset-classic": "^2.0.0-beta.14",
"@docusaurus/core": "^2.3.1",
"@docusaurus/plugin-google-gtag": "^2.3.1",
"@docusaurus/plugin-sitemap": "^2.3.1",
"@docusaurus/preset-classic": "^2.3.1",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.1.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"@vercel/analytics": "^0.1.11",
"clsx": "^1.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"browserslist": {
"production": [
@ -32,9 +36,9 @@
]
},
"devDependencies": {
"docusaurus-plugin-typedoc": "^0.16.6",
"typedoc": "^0.22.10",
"typedoc-plugin-markdown": "^3.11.8",
"typescript": "^4.5.4"
"docusaurus-plugin-typedoc": "^0.18.0",
"typedoc": "^0.24.0-beta.2",
"typedoc-plugin-markdown": "^3.14.0",
"typescript": "^4.9.5"
}
}

View File

@ -5,6 +5,7 @@ import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';
import styles from './styles.module.css';
import { Analytics } from '@vercel/analytics/react'
const features = [
{
@ -56,8 +57,8 @@ function Home() {
const {siteConfig = {}} = context;
return (
<Layout
title={`Hello from ${siteConfig.title}`}
description="Description will go into a meta tag in <head />">
title="VisionCamera Documentation"
description="📸 The Camera library that sees the vision.">
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
<h1 className="hero__title">{siteConfig.title}</h1>
@ -86,6 +87,8 @@ function Home() {
</div>
</section>
)}
<Analytics />
</main>
</Layout>
);

BIN
docs/static/img/multi-camera.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

9
docs/static/robots.txt vendored Normal file
View File

@ -0,0 +1,9 @@
# *
User-agent: *
Allow: /
# Host
Host: https://react-native-vision-camera.com
# Sitemaps
Sitemap: https://react-native-vision-camera.com/sitemap.xml

File diff suppressed because it is too large Load Diff

View File

@ -66,7 +66,7 @@
"bugs": {
"url": "https://github.com/mrousavy/react-native-vision-camera/issues"
},
"homepage": "https://mrousavy.github.io/react-native-vision-camera/",
"homepage": "https://react-native-vision-camera.com/",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},

View File

@ -36,7 +36,7 @@ type RefType = React.Component<NativeCameraViewProps> & Readonly<NativeMethods>;
/**
* ### A powerful `<Camera>` component.
*
* Read the [VisionCamera documentation](https://mrousavy.github.io/react-native-vision-camera/) for more information.
* Read the [VisionCamera documentation](https://react-native-vision-camera.com/) for more information.
*
* The `<Camera>` component's most important (and therefore _required_) properties are:
*

View File

@ -248,11 +248,11 @@ export interface CameraDevice {
/**
* 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 {@linkcode CameraProps.format | Camera's .format} property.
*
* See [the Camera Formats documentation](https://mrousavy.github.io/react-native-vision-camera/docs/guides/formats) for more information about Camera Formats.
* See [the Camera Formats documentation](https://react-native-vision-camera.com/docs/guides/formats) for more information about Camera Formats.
*/
formats: CameraDeviceFormat[];
/**
* Whether this camera device supports using Video Recordings (`video={true}`) and Frame Processors (`frameProcessor={...}`) at the same time. See ["The `supportsParallelVideoProcessing` prop"](https://mrousavy.github.io/react-native-vision-camera/docs/guides/devices#the-supportsparallelvideoprocessing-prop) for more information.
* Whether this camera device supports using Video Recordings (`video={true}`) and Frame Processors (`frameProcessor={...}`) at the same time. See ["The `supportsParallelVideoProcessing` prop"](https://react-native-vision-camera.com/docs/guides/devices#the-supportsparallelvideoprocessing-prop) for more information.
*
* If this property is `false`, you can only enable `video` or add a `frameProcessor`, but not both.
*

View File

@ -154,14 +154,14 @@ class CameraError<TCode extends CameraErrorCode> extends Error {
/**
* Represents any kind of error that occured while trying to capture a video or photo.
*
* See the ["Camera Errors" documentation](https://mrousavy.github.io/react-native-vision-camera/docs/guides/errors) for more information about Camera Errors.
* See the ["Camera Errors" documentation](https://react-native-vision-camera.com/docs/guides/errors) for more information about Camera Errors.
*/
export class CameraCaptureError extends CameraError<CaptureError> {}
/**
* Represents any kind of error that occured in the Camera View Module.
*
* See the ["Camera Errors" documentation](https://mrousavy.github.io/react-native-vision-camera/docs/guides/errors) for more information about Camera Errors.
* See the ["Camera Errors" documentation](https://react-native-vision-camera.com/docs/guides/errors) for more information about Camera Errors.
*/
export class CameraRuntimeError extends CameraError<
PermissionError | ParameterError | DeviceError | FormatError | SessionError | SystemError | UnknownError

View File

@ -18,7 +18,7 @@ export interface CameraProps extends ViewProps {
/**
* The Camera Device to use.
*
* See the [Camera Devices](https://mrousavy.github.io/react-native-vision-camera/docs/guides/devices) section in the documentation for more information about Camera Devices.
* 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
@ -36,7 +36,7 @@ export interface CameraProps extends ViewProps {
*/
device: CameraDevice;
/**
* Whether the Camera should actively stream video frames, or not. See the [documentation about the `isActive` prop](https://mrousavy.github.io/react-native-vision-camera/docs/guides/lifecycle#the-isactive-prop) for more information.
* 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.
*
@ -46,17 +46,17 @@ export interface CameraProps extends ViewProps {
//#region Use-cases
/**
* Enables **photo capture** with the `takePhoto` function (see ["Taking Photos"](https://mrousavy.github.io/react-native-vision-camera/docs/guides/capturing#taking-photos))
* Enables **photo capture** with the `takePhoto` function (see ["Taking Photos"](https://react-native-vision-camera.com/docs/guides/capturing#taking-photos))
*/
photo?: boolean;
/**
* Enables **video capture** with the `startRecording` function (see ["Recording Videos"](https://mrousavy.github.io/react-native-vision-camera/docs/guides/capturing/#recording-videos))
* Enables **video capture** with the `startRecording` function (see ["Recording Videos"](https://react-native-vision-camera.com/docs/guides/capturing/#recording-videos))
*
* Note: If you want to use `video` and `frameProcessor` simultaneously, make sure [`supportsParallelVideoProcessing`](https://mrousavy.github.io/react-native-vision-camera/docs/guides/devices#the-supportsparallelvideoprocessing-prop) is `true`.
* Note: If you want to use `video` and `frameProcessor` simultaneously, make sure [`supportsParallelVideoProcessing`](https://react-native-vision-camera.com/docs/guides/devices#the-supportsparallelvideoprocessing-prop) is `true`.
*/
video?: boolean;
/**
* Enables **audio capture** for video recordings (see ["Recording Videos"](https://mrousavy.github.io/react-native-vision-camera/docs/guides/capturing/#recording-videos))
* Enables **audio capture** for video recordings (see ["Recording Videos"](https://react-native-vision-camera.com/docs/guides/capturing/#recording-videos))
*/
audio?: boolean;
//#endregion
@ -85,7 +85,7 @@ export interface CameraProps extends ViewProps {
/**
* 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://mrousavy.github.io/react-native-vision-camera/docs/guides/animated).
* 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
*/
@ -183,7 +183,7 @@ export interface CameraProps extends ViewProps {
*
* If {@linkcode previewType | previewType} is set to `"skia"`, you can draw content to the `Frame` using the react-native-skia API.
*
* Note: If you want to use `video` and `frameProcessor` simultaneously, make sure [`supportsParallelVideoProcessing`](https://mrousavy.github.io/react-native-vision-camera/docs/guides/devices#the-supportsparallelvideoprocessing-prop) is `true`.
* Note: If you want to use `video` and `frameProcessor` simultaneously, make sure [`supportsParallelVideoProcessing`](https://react-native-vision-camera.com/docs/guides/devices#the-supportsparallelvideoprocessing-prop) is `true`.
*
* > See [the Frame Processors documentation](https://mrousavy.github.io/react-native-vision-camera/docs/guides/frame-processors) for more information
*