// Copyright (C) 2018 Beijing Bytedance Network Technology Co., Ltd. #import #import #import "BEGLView.h" #define AVCaptureSessionPreset NSString* @class BEVideoCapture; typedef NS_ENUM(NSInteger, VideoCaptureError) { VideoCaptureErrorAuthNotGranted = 0, VideoCaptureErrorFailedCreateInput = 1, VideoCaptureErrorFailedAddDataOutput = 2, VideoCaptureErrorFailedAddDeviceInput = 3, }; @protocol BEVideoCaptureDelegate - (void)videoCapture:(BEVideoCapture *)camera didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer andType:(int )type;//1video 2audio - (void)videoCapture:(BEVideoCapture *)camera didFailedToStartWithError:(VideoCaptureError)error; @end @interface BEVideoCapture : NSObject @property (nonatomic, assign) id delegate; @property (nonatomic, readonly) AVCaptureDevicePosition devicePosition; // default AVCaptureDevicePositionFront @property (nonatomic, assign) AVCaptureVideoOrientation videoOrientation; @property (nonatomic, copy) AVCaptureSessionPreset sessionPreset; // default 1280x720 @property (nonatomic, assign) BOOL isOutputWithYUV; // default NO - (CGSize)videoSize; - (void)startRunning; - (void)stopRunning; - (void)pause; - (void)resume; - (void)switchCamera; - (void)switchCamera:(AVCaptureDevicePosition)position; - (void) switchToQRCodeScanWithTopView:(BEGLView*) topView; - (void) switchToVideoCaptureWithTopView:(BEGLView*) topView; - (CGRect)getZoomedRectWithRect:(CGRect)rect scaleToFit:(BOOL)scaleToFit; - (void)setFlip:(BOOL)isFlip; - (void)setOrientation:(AVCaptureVideoOrientation)orientation; - (void) setExposure:(float) exposure; - (void) setExposurePointOfInterest:(CGPoint) point; - (void) setFocusPointOfInterest:(CGPoint) point; - (CGRect)getZoomedRectWithRect1:(CGRect)rect scaleToFit:(BOOL)bScaleToFit; @end