Skip to content

A VisionCamera Frame Processor Plugin to capture video frame

License

Notifications You must be signed in to change notification settings

ishikawa/vision-camera-plugin-capture

Repository files navigation

vision-camera-plugin-capture

A tiny VisionCamera Frame Processor Plugin to capture a video frame.

  • JPEG/PNG format
  • Currently, supports iOS only

Installation

npm install vision-camera-plugin-capture

Setup

Frame Processors require react-native-reanimated 2.2.0 or higher. Also make sure to add

import 'react-native-reanimated';

to the top of the file when using useFrameProcessor.

Add this to your babel.config.js.

[
  'react-native-reanimated/plugin',
  {
    globals: ['__captureVideoFrame'],
  },
];

Usage

import 'react-native-reanimated';
import { useFrameProcessor } from 'react-native-vision-camera';
import { captureVideoFrame } from 'vision-camera-plugin-capture';

// ...

const frameProcessor = useFrameProcessor((frame) => {
  'worklet';
  const value = captureVideoFrame(frame, {
    format: 'JPEG',
  });

  if (value) {
    console.log(value.base64);
  }
}, []);

License

MIT

About

A VisionCamera Frame Processor Plugin to capture video frame

Resources

License

Stars

Watchers

Forks

Packages

No packages published