TuSDKVideoCameraBase Class Reference

Inherits from SLGPUImageStillCamera
Conforms to TuSDKVideoCameraInterface
Declared in TuSDKVideoCameraBase.h

Overview

视频相机基类

特效管理

Other Methods

  sampleBufferDelegate

相机帧采样缓冲委托

@property (nonatomic, weak) id<TuSDKVideoCameraSampleBufferDelegate> _Nullable sampleBufferDelegate

Declared In

TuSDKVideoCameraBase.h

  faceDetectionDelegate

人脸检测结果委托

@property (nonatomic, weak) id<TuSDKVideoCameraFaceDetectionDelegate> _Nullable faceDetectionDelegate

Availability

v3.0.1

Declared In

TuSDKVideoCameraBase.h

  effectDelegate

特效数据委托对象

@property (nonatomic, weak) id<TuSDKVideoCameraEffectDelegate> _Nullable effectDelegate

Availability

v3.2.0

Declared In

TuSDKVideoCameraBase.h

  focusTouchDelegate

聚焦视图点击委托对象

@property (nonatomic, weak) id<TuSDKCPFocusTouchViewDelegate> _Nullable focusTouchDelegate

Availability

v3.5.1

Declared In

TuSDKVideoCameraBase.h

  state

相机状态

@property (nonatomic, readonly) lsqCameraState state

Declared In

TuSDKVideoCameraBase.h

  faceDetectionResultType

人脸检测结果

@property (nonatomic, readonly) lsqVideoCameraFaceDetectionResultType faceDetectionResultType

Availability

v3.0.1

Declared In

TuSDKVideoCameraBase.h

  captureSize

采集尺寸

@property (nonatomic, readonly) CGSize captureSize

Declared In

TuSDKVideoCameraBase.h

  regionHandler

选区范围算法

@property (nonatomic, retain) id<TuSDKCPRegionHandler> _Nullable regionHandler

Declared In

TuSDKVideoCameraBase.h

  isFilterChanging

是否正在切换滤镜

@property (nonatomic, readonly) BOOL isFilterChanging

Declared In

TuSDKVideoCameraBase.h

  enableFilterConfig

开启滤镜配置选项

@property (nonatomic) BOOL enableFilterConfig

Declared In

TuSDKVideoCameraBase.h

  disableTapFocus

禁止触摸聚焦功能 (默认: NO)

@property (nonatomic) BOOL disableTapFocus

Declared In

TuSDKVideoCameraBase.h

  disableTapExposure

禁止触摸曝光功能 (默认: NO)

@property (nonatomic) BOOL disableTapExposure

Availability

v3.4.2

Declared In

TuSDKVideoCameraBase.h

  enableLongTouchCapture

是否开启长按拍摄 (默认: NO) 禁用对焦功能

@property (nonatomic) BOOL enableLongTouchCapture

Declared In

TuSDKVideoCameraBase.h

  disableContinueFoucs

禁用持续自动对焦 (默认: NO)

@property (nonatomic) BOOL disableContinueFoucs

Declared In

TuSDKVideoCameraBase.h

  autoFoucsDelay

自动聚焦延时 (默认: 5秒)

@property (nonatomic) NSTimeInterval autoFoucsDelay

Declared In

TuSDKVideoCameraBase.h

  longTouchDelay

长按延时 (默认: 1.2秒)

@property (nonatomic) NSTimeInterval longTouchDelay

Declared In

TuSDKVideoCameraBase.h

  cameraViewRatio

视频视图显示比例 (默认:0, 0 <= mRegionRatio, 当设置为0时全屏显示)

@property (nonatomic) CGFloat cameraViewRatio

Discussion

1:1 正方形 | 2:3 | 3:4 | 9:16

Declared In

TuSDKVideoCameraBase.h

  regionViewColor

视频覆盖区域颜色 (默认:[UIColor blackColor])

@property (nonatomic, retain) UIColor *regionViewColor

Declared In

TuSDKVideoCameraBase.h

  displayGuideLine

默认是否显示辅助线 (默认: false)

@property (nonatomic) BOOL displayGuideLine

Declared In

TuSDKVideoCameraBase.h

  outputSize

输出画面分辨率,默认原始采样尺寸输出。 如果设置了输出尺寸,则对画面进行等比例缩放,必要时进行裁剪,保证输出尺寸和预设尺寸一致。

@property (nonatomic) CGSize outputSize

Declared In

TuSDKVideoCameraBase.h

  disableMirrorFrontFacing

禁用前置摄像头水平镜像 (默认: NO,前置摄像头输出画面进行水平镜像)

@property (nonatomic) BOOL disableMirrorFrontFacing

Declared In

TuSDKVideoCameraBase.h

  enableFaceDetection

是否开启人脸检测 默认:NO

@property (nonatomic) BOOL enableFaceDetection

Availability

v3.0.1

Declared In

TuSDKVideoCameraBase.h

  enableLiveSticker

是否开启动态贴纸 (默认: NO)

@property (nonatomic) BOOL enableLiveSticker

Declared In

TuSDKVideoCameraBase.h

  enableFaceFocus

是否开启人脸聚焦

@property (nonatomic) BOOL enableFaceFocus

Availability

v3.0.1

Declared In

TuSDKVideoCameraBase.h

  enableFocalDistance

是否开启焦距调节 (默认关闭)

@property (nonatomic, assign) BOOL enableFocalDistance

Declared In

TuSDKVideoCameraBase.h

  focalDistanceScale

相机显示焦距 (默认为 1,最大不可超过硬件最大值,当小于 1 时,取 1)

@property (nonatomic, assign) CGFloat focalDistanceScale

Declared In

TuSDKVideoCameraBase.h

  supportMaxFocalDistanceScale

相机支持的最大值 (只读属性)

@property (nonatomic, readonly, assign) CGFloat supportMaxFocalDistanceScale

Declared In

TuSDKVideoCameraBase.h

  enableProcessBenchmark

是否开启性能测试

@property (nonatomic) BOOL enableProcessBenchmark

Declared In

TuSDKVideoCameraBase.h

  waterMarkImage

设置水印图片,最大边长不宜超过 500

@property (nonatomic, retain) UIImage *waterMarkImage

Declared In

TuSDKVideoCameraBase.h

  waterMarkPosition

水印位置,默认 lsqWaterMarkBottomRight

@property (nonatomic) lsqWaterMarkPosition waterMarkPosition

Declared In

TuSDKVideoCameraBase.h

– initWithSessionPreset:cameraPosition:cameraView:

初始化

- (instancetype _Nullable)initWithSessionPreset:(NSString *_Nonnull)sessionPreset cameraPosition:(AVCaptureDevicePosition)cameraPosition cameraView:(UIView *_Nonnull)view

Parameters

sessionPreset

相机分辨率类型

cameraPosition

相机设备标识 (前置或后置)

view

相机显示容器视图

Return Value

相机对象

Declared In

TuSDKVideoCameraBase.h

– initCamera

初始化相机

- (void)initCamera

Declared In

TuSDKVideoCameraBase.h

– resetAudioSessionCategory

重新设置音频会话分类

- (void)resetAudioSessionCategory

Declared In

TuSDKVideoCameraBase.h

– updateCameraLayout

更新相机视图布局

- (void)updateCameraLayout

Declared In

TuSDKVideoCameraBase.h

– updateCameraViewBounds:

更新相机视图bounds

- (void)updateCameraViewBounds:(CGRect)bounds

Declared In

TuSDKVideoCameraBase.h

– getFocusTouchView

获取聚焦视图

- (UIView<TuSDKVideoCameraExtendViewInterface> *_Nonnull)getFocusTouchView

Return Value

聚焦视图

Declared In

TuSDKVideoCameraBase.h

– focusWithMode:

设置聚焦模式

- (BOOL)focusWithMode:(AVCaptureFocusMode)focusMode

Parameters

focusMode

聚焦模式

Return Value

是否支持对焦

Declared In

TuSDKVideoCameraBase.h

– getInputCameraDeviceFormat

获取当前摄像头的 activeFormat

- (AVCaptureDeviceFormat *_Nullable)getInputCameraDeviceFormat

Return Value

activeFormat

Availability

v3.4.2

Declared In

TuSDKVideoCameraBase.h

– focusWithMode:point:

设置聚焦模式

- (BOOL)focusWithMode:(AVCaptureFocusMode)focusMode point:(CGPoint)point

Parameters

focusMode

聚焦模式

point

聚焦坐标

Return Value

是否支持对焦

Declared In

TuSDKVideoCameraBase.h

– exposureWithMode:

设置曝光模式, 默认AVCaptureExposureModeContinuousAutoExposure

- (BOOL)exposureWithMode:(AVCaptureExposureMode)exposureMode

Parameters

exposureMode

曝光模式

Return Value

是否支持曝光模式

Declared In

TuSDKVideoCameraBase.h

– exposureWithMode:point:

设置曝光模式, 默认AVCaptureExposureModeContinuousAutoExposure

- (BOOL)exposureWithMode:(AVCaptureExposureMode)exposureMode point:(CGPoint)point

Parameters

exposureMode

曝光模式

point

曝光点,[(0,0),(1,1)]

Return Value

是否支持曝光模式

Availability

3.4.2

Declared In

TuSDKVideoCameraBase.h

– exposureWithBias:

设置曝光补偿 bias

- (BOOL)exposureWithBias:(float)bias

Parameters

bias

[-8 8]

Return Value

是否设置成功

Availability

v3.4.2

Declared In

TuSDKVideoCameraBase.h

– notifyCameraStateChanged:

通知相机状态发生改变

- (void)notifyCameraStateChanged:(lsqCameraState)newState

Parameters

newState

新的状态

Declared In

TuSDKVideoCameraBase.h

– onCameraStateChanged:

相机状态发生改变

- (void)onCameraStateChanged:(lsqCameraState)newState

Parameters

newState

新的状态

Declared In

TuSDKVideoCameraBase.h

– updateOutputFilter

更新滤镜输出配置

- (void)updateOutputFilter

Declared In

TuSDKVideoCameraBase.h

– markRecalculateCaptureSize

标记需要重新计算裁剪的画面大小

- (void)markRecalculateCaptureSize

Declared In

TuSDKVideoCameraBase.h

– notifyCaptureResult:

通知拍照结果

- (void)notifyCaptureResult:(UIImage *_Nullable)result

Parameters

result

拍摄照片

Declared In

TuSDKVideoCameraBase.h

– capturePhotoAsImageCompletionHandler:

拍摄图片

- (BOOL)capturePhotoAsImageCompletionHandler:(void ( ^ _Nonnull ) ( UIImage *_Nullable processedImage , NSError *_Nullable error ))block

Parameters

block

拍照完成数据回调

Availability

v3.4.1

Declared In

TuSDKVideoCameraBase.h

– switchFilterWithCode:

切换滤镜 v3.2.0 新增 addMediaEffect:接口,可通过该方法添加所有支持的特效。

- (BOOL)switchFilterWithCode:(NSString *_Nullable)code

Parameters

code

滤镜代号

Return Value

是否成功切换滤镜

Declared In

TuSDKVideoCameraBase.h

– showGroupSticker:

显示一组动态贴纸。当显示一组贴纸时,会清除画布上的其它贴纸

- (void)showGroupSticker:(TuSDKPFStickerGroup *_Nullable)groupSticker

Parameters

groupSticker

动态贴纸对象

Declared In

TuSDKVideoCameraBase.h

– isGroupStickerUsed:

动态贴纸组是否已在使用

- (BOOL)isGroupStickerUsed:(TuSDKPFStickerGroup *_Nonnull)groupSticker

Parameters

groupSticker

动态贴纸组对象

Return Value

是否使用

Declared In

TuSDKVideoCameraBase.h

– removeAllLiveSticker

清除动态贴纸

- (void)removeAllLiveSticker

Declared In

TuSDKVideoCameraBase.h

– setDetectScale:

设置检测框最小倍数 [取值范围: 0.1 < x < 0.5, 默认: 0.2] 值越大性能越高距离越近

- (void)setDetectScale:(CGFloat)scale

Parameters

scale

缩放f比

Declared In

TuSDKVideoCameraBase.h

– runProcessBenchmark

打印性能日志

- (void)runProcessBenchmark

Declared In

TuSDKVideoCameraBase.h

– destory

销毁

- (void)destory

Declared In

TuSDKVideoCameraBase.h

MediaEffectManager Methods

– addMediaEffect:

添加一个多媒体特效。目前支持的特效包括: TuSDKMediaFilterEffect、TuSDKMediaStickerEffect、TuSDKMediaComicEffect、TuSDKMediaSkinFaceEffect、TuSDKMediaPlasticFaceEffect

- (BOOL)addMediaEffect:(id<TuSDKMediaEffect> _Nonnull)mediaEffect

Parameters

mediaEffect

特效数据

Return Value

true 添加成功 false 添加失败不支持该特效或特效数据错误

Availability

v3.2.0

Discussion

如果已有特效和该特效不能同时共存,已有旧特效将被移除.

Declared In

TuSDKVideoCameraBase.h

– removeMediaEffect:

移除特效数据

- (void)removeMediaEffect:(id<TuSDKMediaEffect> _Nonnull)mediaEffect

Parameters

mediaEffect

TuSDKMediaEffectData

Availability

v3.2.0

Declared In

TuSDKVideoCameraBase.h

– removeMediaEffectsWithType:

移除指定类型的特效信息

- (void)removeMediaEffectsWithType:(NSUInteger)effectType

Parameters

effectType

特效类型

Availability

v3.2.0

Declared In

TuSDKVideoCameraBase.h

– removeAllMediaEffect

移除所有特效

- (void)removeAllMediaEffect

Availability

v3.2.0

Declared In

TuSDKVideoCameraBase.h

– mediaEffectsWithType:

获取指定类型的特效信息

- (NSArray<id<TuSDKMediaEffect> > *_Nonnull)mediaEffectsWithType:(NSUInteger)effectType

Parameters

effectType

特效数据类型

Return Value

特效列表

Availability

v3.2.0

Declared In

TuSDKVideoCameraBase.h