UNPKG

react-native-vision-camera-detector

Version:

Frame Processor Plugin to detect faces & texts using MLKit Vision Face Detector for React Native Vision Camera!

22 lines (19 loc) 608 B
import type { Frame, TranslatorPlugin, TranslatorOptions } from './types'; import { VisionCameraProxy } from 'react-native-vision-camera'; const LINKING_ERROR = `Can't load plugin translate.Try cleaning cache or reinstall plugin.`; export function createTranslatorPlugin( options?: TranslatorOptions ): TranslatorPlugin { const plugin = VisionCameraProxy.initFrameProcessorPlugin('translate', { ...options, }); if (!plugin) { throw new Error(LINKING_ERROR); } return { translate: (frame: Frame): string => { 'worklet'; return plugin.call(frame) as string; }, }; }