2021-02-19 08:28:05 -07:00
|
|
|
//
|
|
|
|
// CameraViewManager.m
|
2021-06-21 14:42:46 -06:00
|
|
|
// mrousavy
|
2021-02-19 08:28:05 -07:00
|
|
|
//
|
|
|
|
// Created by Marc Rousavy on 09.11.20.
|
2021-06-01 05:07:57 -06:00
|
|
|
// Copyright © 2020 mrousavy. All rights reserved.
|
2021-02-19 08:28:05 -07:00
|
|
|
//
|
|
|
|
|
2021-03-31 07:43:29 -06:00
|
|
|
#import <Foundation/Foundation.h>
|
2021-05-06 06:11:55 -06:00
|
|
|
|
|
|
|
#import <React/RCTUtils.h>
|
2023-09-01 04:58:32 -06:00
|
|
|
#import <React/RCTViewManager.h>
|
2021-02-19 08:28:05 -07:00
|
|
|
|
2023-09-01 04:58:32 -06:00
|
|
|
@interface RCT_EXTERN_REMAP_MODULE (CameraView, CameraViewManager, RCTViewManager)
|
2021-02-19 08:28:05 -07:00
|
|
|
|
|
|
|
// Module Functions
|
2023-12-19 06:22:04 -07:00
|
|
|
RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getCameraPermissionStatus);
|
|
|
|
RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getMicrophonePermissionStatus);
|
2023-09-01 11:39:25 -06:00
|
|
|
RCT_EXTERN_METHOD(requestCameraPermission : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject);
|
|
|
|
RCT_EXTERN_METHOD(requestMicrophonePermission : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject);
|
2021-02-19 08:28:05 -07:00
|
|
|
|
2023-09-21 03:20:33 -06:00
|
|
|
RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(installFrameProcessorBindings);
|
2021-02-19 08:28:05 -07:00
|
|
|
|
|
|
|
// Camera View Properties
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(isActive, BOOL);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(cameraId, NSString);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(enableDepthData, BOOL);
|
2023-10-13 10:33:20 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(enableHighQualityPhotos, BOOL);
|
2021-02-19 08:28:05 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(enablePortraitEffectsMatteDelivery, BOOL);
|
2023-09-21 09:18:54 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(enableBufferCompression, BOOL);
|
2021-06-07 05:08:40 -06:00
|
|
|
// use cases
|
2023-10-13 10:33:20 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(photo, BOOL);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(video, BOOL);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(audio, BOOL);
|
2021-07-12 07:16:03 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(enableFrameProcessor, BOOL);
|
2021-02-19 08:28:05 -07:00
|
|
|
// device format
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(format, NSDictionary);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(fps, NSNumber);
|
2023-11-15 10:33:12 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(videoHdr, BOOL);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(photoHdr, BOOL);
|
2023-10-13 10:33:20 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(lowLightBoost, BOOL);
|
2021-06-03 07:42:02 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(videoStabilizationMode, NSString);
|
2023-08-24 09:14:24 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(pixelFormat, NSString);
|
2021-02-19 08:28:05 -07:00
|
|
|
// other props
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(torch, NSString);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(zoom, NSNumber);
|
2023-11-19 07:26:43 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(exposure, NSNumber);
|
2021-02-19 08:28:05 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(enableZoomGesture, BOOL);
|
2023-02-21 07:00:48 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(enableFpsGraph, BOOL);
|
2022-01-04 08:57:40 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(orientation, NSString);
|
2023-09-23 02:14:27 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString);
|
2021-10-11 10:27:23 -06:00
|
|
|
// Camera View Events
|
2021-02-19 08:28:05 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onError, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onInitialized, RCTDirectEventBlock);
|
2023-12-09 11:09:55 -07:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onStarted, RCTDirectEventBlock);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onStopped, RCTDirectEventBlock);
|
2021-10-11 10:27:23 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onViewReady, RCTDirectEventBlock);
|
2024-07-15 02:55:47 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onInitReady, RCTDirectEventBlock);
|
2024-07-15 02:50:39 -06:00
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onVideoChunkReady, RCTDirectEventBlock);
|
2023-10-04 04:53:52 -06:00
|
|
|
// Code Scanner
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(codeScannerOptions, NSDictionary);
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(onCodeScanned, RCTDirectEventBlock);
|
2021-02-19 08:28:05 -07:00
|
|
|
|
|
|
|
// Camera View Functions
|
2023-09-01 04:58:32 -06:00
|
|
|
RCT_EXTERN_METHOD(startRecording
|
|
|
|
: (nonnull NSNumber*)node options
|
|
|
|
: (NSDictionary*)options onRecordCallback
|
|
|
|
: (RCTResponseSenderBlock)onRecordCallback);
|
|
|
|
RCT_EXTERN_METHOD(pauseRecording
|
|
|
|
: (nonnull NSNumber*)node resolve
|
|
|
|
: (RCTPromiseResolveBlock)resolve reject
|
|
|
|
: (RCTPromiseRejectBlock)reject);
|
|
|
|
RCT_EXTERN_METHOD(resumeRecording
|
|
|
|
: (nonnull NSNumber*)node resolve
|
|
|
|
: (RCTPromiseResolveBlock)resolve reject
|
|
|
|
: (RCTPromiseRejectBlock)reject);
|
2023-09-01 11:39:25 -06:00
|
|
|
RCT_EXTERN_METHOD(stopRecording : (nonnull NSNumber*)node resolve : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject);
|
2023-09-01 04:58:32 -06:00
|
|
|
RCT_EXTERN_METHOD(takePhoto
|
|
|
|
: (nonnull NSNumber*)node options
|
|
|
|
: (NSDictionary*)options resolve
|
|
|
|
: (RCTPromiseResolveBlock)resolve reject
|
|
|
|
: (RCTPromiseRejectBlock)reject);
|
|
|
|
RCT_EXTERN_METHOD(focus
|
|
|
|
: (nonnull NSNumber*)node point
|
|
|
|
: (NSDictionary*)point resolve
|
|
|
|
: (RCTPromiseResolveBlock)resolve reject
|
|
|
|
: (RCTPromiseRejectBlock)reject);
|
2021-02-19 08:28:05 -07:00
|
|
|
|
|
|
|
@end
|