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
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
2015-04-10 19:56:30 -07:00
|
|
|
@property (nonatomic) dispatch_queue_t sessionQueue;
|
|
|
|
@property (nonatomic) AVCaptureSession *session;
|
2015-07-09 20:11:50 -07:00
|
|
|
@property (nonatomic) AVCaptureDeviceInput *audioCaptureDeviceInput;
|
|
|
|
@property (nonatomic) AVCaptureDeviceInput *videoCaptureDeviceInput;
|
2015-04-10 19:56:30 -07:00
|
|
|
@property (nonatomic) AVCaptureStillImageOutput *stillImageOutput;
|
2015-06-14 19:16:09 +02:00
|
|
|
@property (nonatomic) AVCaptureMovieFileOutput *movieFileOutput;
|
2015-04-19 15:53:30 -07:00
|
|
|
@property (nonatomic) AVCaptureMetadataOutput *metadataOutput;
|
2015-04-10 19:56:30 -07:00
|
|
|
@property (nonatomic) id runtimeErrorHandlingObserver;
|
|
|
|
@property (nonatomic) NSInteger presetCamera;
|
2015-04-16 17:16:35 -07:00
|
|
|
@property (nonatomic) AVCaptureVideoPreviewLayer *previewLayer;
|
2015-07-02 13:04:25 -07:00
|
|
|
@property (nonatomic) NSInteger videoTarget;
|
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-16 17:16:35 -07:00
|
|
|
- (void)changeAspect:(NSString *)aspect;
|
2015-04-10 19:56:30 -07:00
|
|
|
- (void)changeCamera:(NSInteger)camera;
|
|
|
|
- (void)changeOrientation:(NSInteger)orientation;
|
2015-05-31 00:36:55 +08:00
|
|
|
- (void)changeFlashMode:(NSInteger)flashMode;
|
2015-06-15 20:58:36 +02:00
|
|
|
- (void)changeTorchMode:(NSInteger)torchMode;
|
2015-04-10 19:56:30 -07: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-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
|