mirror of
https://github.com/status-im/react-native-camera.git
synced 2025-02-24 17:58:20 +00:00
* Add 1080p, 720p, and 480p capture qualities. * Minor improvements for picture/video sizing. - Minor refactoring for getting supported sizes (DRY). - Add explicit pictureSize setting for 480p/720p/1080p in still/picture mode. * Use util.Size objects for 480p/720p/1080p sizing. - Note using Camera.Size objects would require a camera instance prior to creating the size objects, which would be manageable but not too clean. * Remove 480p for iOS; 16:9/HD aspect ratio for Android 480p - iOS only has a 640x480 480p-like AVCaptureSessionPreset, which is not the typical 16:9/HD aspect ratio desired. Removing this option as a result of this. - Android 480p updated to use 16:9/HD aspect ratio. * Add notes for (in)exact sizing for 1080p/720p/480p * Re-add 480p on iOS, more notes on resolutions. - Add notes on non-HD-aspect-ratio for iOS 480p. - Add more explanation of variable resolution/sizes, especially for 480p on Android. * Use custom Resolution class to hold 480p/720p/1080p resolution sizes - Mistakenly used util.Size class before, which was not added until Android API level 21 (current min is 16).
94 lines
3.6 KiB
Objective-C
94 lines
3.6 KiB
Objective-C
#import "RCTViewManager.h"
|
|
#import <AVFoundation/AVFoundation.h>
|
|
|
|
@class RCTCamera;
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraAspect) {
|
|
RCTCameraAspectFill = 0,
|
|
RCTCameraAspectFit = 1,
|
|
RCTCameraAspectStretch = 2
|
|
};
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraCaptureSessionPreset) {
|
|
RCTCameraCaptureSessionPresetLow = 0,
|
|
RCTCameraCaptureSessionPresetMedium = 1,
|
|
RCTCameraCaptureSessionPresetHigh = 2,
|
|
RCTCameraCaptureSessionPresetPhoto = 3,
|
|
RCTCameraCaptureSessionPreset480p = 4,
|
|
RCTCameraCaptureSessionPreset720p = 5,
|
|
RCTCameraCaptureSessionPreset1080p = 6
|
|
};
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraCaptureMode) {
|
|
RCTCameraCaptureModeStill = 0,
|
|
RCTCameraCaptureModeVideo = 1
|
|
};
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraCaptureTarget) {
|
|
RCTCameraCaptureTargetMemory = 0,
|
|
RCTCameraCaptureTargetDisk = 1,
|
|
RCTCameraCaptureTargetTemp = 2,
|
|
RCTCameraCaptureTargetCameraRoll = 3
|
|
};
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraOrientation) {
|
|
RCTCameraOrientationAuto = 0,
|
|
RCTCameraOrientationLandscapeLeft = AVCaptureVideoOrientationLandscapeLeft,
|
|
RCTCameraOrientationLandscapeRight = AVCaptureVideoOrientationLandscapeRight,
|
|
RCTCameraOrientationPortrait = AVCaptureVideoOrientationPortrait,
|
|
RCTCameraOrientationPortraitUpsideDown = AVCaptureVideoOrientationPortraitUpsideDown
|
|
};
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraType) {
|
|
RCTCameraTypeFront = AVCaptureDevicePositionFront,
|
|
RCTCameraTypeBack = AVCaptureDevicePositionBack
|
|
};
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraFlashMode) {
|
|
RCTCameraFlashModeOff = AVCaptureFlashModeOff,
|
|
RCTCameraFlashModeOn = AVCaptureFlashModeOn,
|
|
RCTCameraFlashModeAuto = AVCaptureFlashModeAuto
|
|
};
|
|
|
|
typedef NS_ENUM(NSInteger, RCTCameraTorchMode) {
|
|
RCTCameraTorchModeOff = AVCaptureTorchModeOff,
|
|
RCTCameraTorchModeOn = AVCaptureTorchModeOn,
|
|
RCTCameraTorchModeAuto = AVCaptureTorchModeAuto
|
|
};
|
|
|
|
@interface RCTCameraManager : RCTViewManager<AVCaptureMetadataOutputObjectsDelegate, AVCaptureFileOutputRecordingDelegate>
|
|
|
|
@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;
|
|
@property (nonatomic, assign) NSInteger orientation;
|
|
@property (nonatomic, assign) BOOL mirrorImage;
|
|
@property (nonatomic, strong) NSArray* barCodeTypes;
|
|
@property (nonatomic, strong) RCTPromiseResolveBlock videoResolve;
|
|
@property (nonatomic, strong) RCTPromiseRejectBlock videoReject;
|
|
@property (nonatomic, strong) RCTCamera *camera;
|
|
|
|
|
|
- (void)changeOrientation:(NSInteger)orientation;
|
|
- (AVCaptureDevice *)deviceWithMediaType:(NSString *)mediaType preferringPosition:(AVCaptureDevicePosition)position;
|
|
- (void)capture:(NSDictionary*)options resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
- (void)getFOV:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
- (void)hasFlash:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
- (void)initializeCaptureSessionInput:(NSString*)type;
|
|
- (void)stopCapture;
|
|
- (void)startSession;
|
|
- (void)stopSession;
|
|
- (void)focusAtThePoint:(CGPoint) atPoint;
|
|
- (void)zoom:(CGFloat)velocity reactTag:(NSNumber *)reactTag;
|
|
|
|
|
|
@end
|