2015-03-31 18:02:57 -07:00
|
|
|
#import "RCTViewManager.h"
|
2015-04-02 02:40:03 -07:00
|
|
|
#import <AVFoundation/AVFoundation.h>
|
|
|
|
|
|
|
|
@class RCTCamera;
|
2015-03-31 18:02:57 -07:00
|
|
|
|
2015-05-01 14:33:23 -07:00
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraAspect) {
|
2015-07-09 20:11:50 -07:00
|
|
|
RCTCameraAspectFill = 0,
|
|
|
|
RCTCameraAspectFit = 1,
|
|
|
|
RCTCameraAspectStretch = 2
|
2015-05-01 14:33:23 -07:00
|
|
|
};
|
|
|
|
|
2016-08-02 23:22:15 +03:00
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraCaptureSessionPreset) {
|
|
|
|
RCTCameraCaptureSessionPresetLow = 0,
|
|
|
|
RCTCameraCaptureSessionPresetMedium = 1,
|
|
|
|
RCTCameraCaptureSessionPresetHigh = 2,
|
2016-11-18 14:38:23 -08:00
|
|
|
RCTCameraCaptureSessionPresetPhoto = 3,
|
|
|
|
RCTCameraCaptureSessionPreset480p = 4,
|
|
|
|
RCTCameraCaptureSessionPreset720p = 5,
|
|
|
|
RCTCameraCaptureSessionPreset1080p = 6
|
2016-08-02 23:22:15 +03:00
|
|
|
};
|
|
|
|
|
2015-05-01 14:33:23 -07:00
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraCaptureMode) {
|
2015-07-09 20:11:50 -07:00
|
|
|
RCTCameraCaptureModeStill = 0,
|
|
|
|
RCTCameraCaptureModeVideo = 1
|
2015-05-01 14:33:23 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraCaptureTarget) {
|
2015-07-09 20:11:50 -07:00
|
|
|
RCTCameraCaptureTargetMemory = 0,
|
|
|
|
RCTCameraCaptureTargetDisk = 1,
|
2016-01-12 10:59:52 -08:00
|
|
|
RCTCameraCaptureTargetTemp = 2,
|
|
|
|
RCTCameraCaptureTargetCameraRoll = 3
|
2015-05-01 14:33:23 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraOrientation) {
|
2015-07-09 20:11:50 -07:00
|
|
|
RCTCameraOrientationAuto = 0,
|
|
|
|
RCTCameraOrientationLandscapeLeft = AVCaptureVideoOrientationLandscapeLeft,
|
|
|
|
RCTCameraOrientationLandscapeRight = AVCaptureVideoOrientationLandscapeRight,
|
|
|
|
RCTCameraOrientationPortrait = AVCaptureVideoOrientationPortrait,
|
|
|
|
RCTCameraOrientationPortraitUpsideDown = AVCaptureVideoOrientationPortraitUpsideDown
|
2015-05-01 14:33:23 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraType) {
|
2015-07-09 20:11:50 -07:00
|
|
|
RCTCameraTypeFront = AVCaptureDevicePositionFront,
|
|
|
|
RCTCameraTypeBack = AVCaptureDevicePositionBack
|
2015-05-01 14:33:23 -07:00
|
|
|
};
|
|
|
|
|
2015-05-31 00:36:55 +08:00
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraFlashMode) {
|
2015-07-09 20:11:50 -07:00
|
|
|
RCTCameraFlashModeOff = AVCaptureFlashModeOff,
|
|
|
|
RCTCameraFlashModeOn = AVCaptureFlashModeOn,
|
|
|
|
RCTCameraFlashModeAuto = AVCaptureFlashModeAuto
|
2015-05-31 00:36:55 +08:00
|
|
|
};
|
|
|
|
|
2015-06-15 20:58:36 +02:00
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraTorchMode) {
|
2015-07-09 20:11:50 -07:00
|
|
|
RCTCameraTorchModeOff = AVCaptureTorchModeOff,
|
|
|
|
RCTCameraTorchModeOn = AVCaptureTorchModeOn,
|
|
|
|
RCTCameraTorchModeAuto = AVCaptureTorchModeAuto
|
2015-06-15 20:58:36 +02:00
|
|
|
};
|
|
|
|
|
2015-07-02 13:04:25 -07:00
|
|
|
@interface RCTCameraManager : RCTViewManager<AVCaptureMetadataOutputObjectsDelegate, AVCaptureFileOutputRecordingDelegate>
|
2015-04-02 02:40:03 -07:00
|
|
|
|
2016-03-23 21:13:35 +02:00
|
|
|
@property (nonatomic, strong) dispatch_queue_t sessionQueue;
|
|
|
|
@property (nonatomic, strong) AVCaptureSession *session;
|
|
|
|
@property (nonatomic, strong) AVCaptureDeviceInput *audioCaptureDeviceInput;
|
|
|
|
@property (nonatomic, strong) AVCaptureDeviceInput *videoCaptureDeviceInput;
|
|
|
|
@property (nonatomic, strong) AVCaptureStillImageOutput *stillImageOutput;
|
|
|
|
@property (nonatomic, strong) AVCaptureMovieFileOutput *movieFileOutput;
|
|
|
|
@property (nonatomic, strong) AVCaptureMetadataOutput *metadataOutput;
|
|
|
|
@property (nonatomic, strong) id runtimeErrorHandlingObserver;
|
|
|
|
@property (nonatomic, assign) NSInteger presetCamera;
|
|
|
|
@property (nonatomic, strong) AVCaptureVideoPreviewLayer *previewLayer;
|
|
|
|
@property (nonatomic, assign) NSInteger videoTarget;
|
2016-04-01 20:48:08 -07:00
|
|
|
@property (nonatomic, assign) NSInteger orientation;
|
2016-02-24 12:34:43 -05:00
|
|
|
@property (nonatomic, assign) BOOL mirrorImage;
|
2016-04-09 02:43:11 +02:00
|
|
|
@property (nonatomic, strong) NSArray* barCodeTypes;
|
2016-01-28 11:14:00 +00:00
|
|
|
@property (nonatomic, strong) RCTPromiseResolveBlock videoResolve;
|
|
|
|
@property (nonatomic, strong) RCTPromiseRejectBlock videoReject;
|
2015-10-10 15:23:27 -07:00
|
|
|
@property (nonatomic, strong) RCTCamera *camera;
|
2015-04-02 02:40:03 -07:00
|
|
|
|
2015-07-27 16:08:33 +06:00
|
|
|
|
2015-04-10 19:56:30 -07:00
|
|
|
- (void)changeOrientation:(NSInteger)orientation;
|
|
|
|
- (AVCaptureDevice *)deviceWithMediaType:(NSString *)mediaType preferringPosition:(AVCaptureDevicePosition)position;
|
2016-01-28 11:14:00 +00:00
|
|
|
- (void)capture:(NSDictionary*)options resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
2016-01-31 19:27:46 -08:00
|
|
|
- (void)getFOV:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
|
|
- (void)hasFlash:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
2015-07-09 20:11:50 -07:00
|
|
|
- (void)initializeCaptureSessionInput:(NSString*)type;
|
2015-06-14 19:16:09 +02:00
|
|
|
- (void)stopCapture;
|
2015-07-19 13:02:35 -07:00
|
|
|
- (void)startSession;
|
|
|
|
- (void)stopSession;
|
2015-07-27 16:08:33 +06:00
|
|
|
- (void)focusAtThePoint:(CGPoint) atPoint;
|
2015-08-11 19:23:06 +06:00
|
|
|
- (void)zoom:(CGFloat)velocity reactTag:(NSNumber *)reactTag;
|
2015-07-27 16:08:33 +06:00
|
|
|
|
2015-04-10 19:56:30 -07:00
|
|
|
|
2015-04-02 02:40:03 -07:00
|
|
|
@end
|