2015-04-01 01:02:57 +00:00
|
|
|
#import "RCTViewManager.h"
|
2015-04-02 09:40:03 +00:00
|
|
|
#import <AVFoundation/AVFoundation.h>
|
|
|
|
|
|
|
|
@class RCTCamera;
|
2015-04-01 01:02:57 +00:00
|
|
|
|
2015-05-01 21:33:23 +00:00
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraAspect) {
|
2015-07-10 03:11:50 +00:00
|
|
|
RCTCameraAspectFill = 0,
|
|
|
|
RCTCameraAspectFit = 1,
|
|
|
|
RCTCameraAspectStretch = 2
|
2015-05-01 21:33:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraCaptureMode) {
|
2015-07-10 03:11:50 +00:00
|
|
|
RCTCameraCaptureModeStill = 0,
|
|
|
|
RCTCameraCaptureModeVideo = 1
|
2015-05-01 21:33:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraCaptureTarget) {
|
2015-07-10 03:11:50 +00:00
|
|
|
RCTCameraCaptureTargetMemory = 0,
|
|
|
|
RCTCameraCaptureTargetDisk = 1,
|
2016-01-12 18:59:52 +00:00
|
|
|
RCTCameraCaptureTargetTemp = 2,
|
|
|
|
RCTCameraCaptureTargetCameraRoll = 3
|
2015-05-01 21:33:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraOrientation) {
|
2015-07-10 03:11:50 +00:00
|
|
|
RCTCameraOrientationAuto = 0,
|
|
|
|
RCTCameraOrientationLandscapeLeft = AVCaptureVideoOrientationLandscapeLeft,
|
|
|
|
RCTCameraOrientationLandscapeRight = AVCaptureVideoOrientationLandscapeRight,
|
|
|
|
RCTCameraOrientationPortrait = AVCaptureVideoOrientationPortrait,
|
|
|
|
RCTCameraOrientationPortraitUpsideDown = AVCaptureVideoOrientationPortraitUpsideDown
|
2015-05-01 21:33:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraType) {
|
2015-07-10 03:11:50 +00:00
|
|
|
RCTCameraTypeFront = AVCaptureDevicePositionFront,
|
|
|
|
RCTCameraTypeBack = AVCaptureDevicePositionBack
|
2015-05-01 21:33:23 +00:00
|
|
|
};
|
|
|
|
|
2015-05-30 16:36:55 +00:00
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraFlashMode) {
|
2015-07-10 03:11:50 +00:00
|
|
|
RCTCameraFlashModeOff = AVCaptureFlashModeOff,
|
|
|
|
RCTCameraFlashModeOn = AVCaptureFlashModeOn,
|
|
|
|
RCTCameraFlashModeAuto = AVCaptureFlashModeAuto
|
2015-05-30 16:36:55 +00:00
|
|
|
};
|
|
|
|
|
2015-06-15 18:58:36 +00:00
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraTorchMode) {
|
2015-07-10 03:11:50 +00:00
|
|
|
RCTCameraTorchModeOff = AVCaptureTorchModeOff,
|
|
|
|
RCTCameraTorchModeOn = AVCaptureTorchModeOn,
|
|
|
|
RCTCameraTorchModeAuto = AVCaptureTorchModeAuto
|
2015-06-15 18:58:36 +00:00
|
|
|
};
|
|
|
|
|
2015-07-02 20:04:25 +00:00
|
|
|
@interface RCTCameraManager : RCTViewManager<AVCaptureMetadataOutputObjectsDelegate, AVCaptureFileOutputRecordingDelegate>
|
2015-04-02 09:40:03 +00:00
|
|
|
|
2016-03-23 19:13:35 +00: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-01-28 11:14:00 +00:00
|
|
|
@property (nonatomic, strong) RCTPromiseResolveBlock videoResolve;
|
|
|
|
@property (nonatomic, strong) RCTPromiseRejectBlock videoReject;
|
2015-10-10 22:23:27 +00:00
|
|
|
@property (nonatomic, strong) RCTCamera *camera;
|
2015-04-02 09:40:03 +00:00
|
|
|
|
2015-07-27 10:08:33 +00:00
|
|
|
|
2015-04-17 00:16:35 +00:00
|
|
|
- (void)changeAspect:(NSString *)aspect;
|
2015-04-11 02:56:30 +00:00
|
|
|
- (void)changeCamera:(NSInteger)camera;
|
|
|
|
- (void)changeOrientation:(NSInteger)orientation;
|
2015-05-30 16:36:55 +00:00
|
|
|
- (void)changeFlashMode:(NSInteger)flashMode;
|
2015-06-15 18:58:36 +00:00
|
|
|
- (void)changeTorchMode:(NSInteger)torchMode;
|
2015-04-11 02:56:30 +00:00
|
|
|
- (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-02-01 03:27:46 +00:00
|
|
|
- (void)getFOV:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
|
|
- (void)hasFlash:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
2015-07-10 03:11:50 +00:00
|
|
|
- (void)initializeCaptureSessionInput:(NSString*)type;
|
2015-06-14 17:16:09 +00:00
|
|
|
- (void)stopCapture;
|
2015-07-19 20:02:35 +00:00
|
|
|
- (void)startSession;
|
|
|
|
- (void)stopSession;
|
2015-07-27 10:08:33 +00:00
|
|
|
- (void)focusAtThePoint:(CGPoint) atPoint;
|
2015-08-11 13:23:06 +00:00
|
|
|
- (void)zoom:(CGFloat)velocity reactTag:(NSNumber *)reactTag;
|
2015-07-27 10:08:33 +00:00
|
|
|
|
2015-04-11 02:56:30 +00:00
|
|
|
|
2015-04-02 09:40:03 +00:00
|
|
|
@end
|