AliyunMixRecorder
@interface AliyunMixRecorder : NSObject
合拍录制器
-
视频的输出路径
必须设置
Declaration
Objective-C
@property (nonatomic, copy) NSString *outputPath;
-
获取播放视频的view
Declaration
Objective-C
@property (nonatomic, readonly) int *preview;
-
Delegate
Declaration
Objective-C
@property (nonatomic, weak) id<AliyunMixRecorderDelegate> delegate;
-
美颜状态是否开启
Declaration
Objective-C
@property (nonatomic) BOOL beautifyStatus;
-
设置美颜度 [0,100]
Declaration
Objective-C
@property (nonatomic) int beautifyValue;
-
曝光值 [0,1]
Declaration
Objective-C
@property (nonatomic) CGFloat exposureValue;
-
前置摄像头采集分辨率
默认:AVCaptureSessionPreset640x480 更多参数参见:AVCaptureSession.h
Declaration
Objective-C
@property (nonatomic, copy) NSString *frontCaptureSessionPreset;
-
后置摄像头采集分辨率
默认:AVCaptureSessionPreset1280x720 更多参数参见:AVCaptureSession.h
Declaration
Objective-C
@property (nonatomic, copy) NSString *backCaptureSessionPreset;
-
摄像头角度
Declaration
Objective-C
@property (nonatomic) int cameraRotate;
-
手动对焦点,相对预览视图的位置
Declaration
Objective-C
@property (nonatomic) CGPoint focusPoint;
-
调整变焦倍数
每次调用videoZoomFactor,实际变焦值zoom为设定的1/100 例:调用videoZoomFactor = 10.0f,实际zoom += 0.1f 例:调用videoZoomFactor = -5.0f,实际zoom -= 0.05f
Declaration
Objective-C
@property (nonatomic) CGFloat videoZoomFactor;
-
设置前置摄像头是否支持调整变焦,后置摄像头默认支持变焦,前置摄像头默认不支持变焦 当supportVideoZoomFactorForFrontCamera = YES时,前置摄像头支持变焦
Declaration
Objective-C
@property (nonatomic) BOOL frontCameraSupportVideoZoomFactor;
-
编码方式
0软编 1硬编 iOS强制硬编
Declaration
Objective-C
@property (nonatomic) int encodeMode;
-
关键帧间隔,有效区间[0, 9000],其中0和1都表示全I帧
默认5
Declaration
Objective-C
@property (nonatomic) int GOP;
-
录制帧率, 取值区间(0,30],区间外的值将视为无效值,依然使用默认值。
默认25
Declaration
Objective-C
@property (nonatomic) int recordFps;
-
是否静音
添加音乐后,静音无效
Declaration
Objective-C
@property (nonatomic) BOOL mute;
-
视频质量,设置bitrate参数后,该参数无效
Declaration
Objective-C
@property (nonatomic) AliyunVideoQuality videoQuality;
-
输出视频码率 bps 最小值200000bps 最大值20000000bps
Declaration
Objective-C
@property (nonatomic) int bitrate;
-
提供三种格式:如果设置不是此三值,将会视情况分配此三种格式中的一种 kCVPixelFormatType_420YpCbCr8BiPlanarFullRange, kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange, kCVPixelFormatType_32BGRA, 默认kCVPixelFormatType_420YpCbCr8BiPlanarFullRange格式
Declaration
Objective-C
@property (nonatomic) AliyunIRecorderVideoOutputPixelFormatType outputType;
-
是否开启人脸识别
使用自带人脸识别,开启该功能,系统会在检测到有人脸动图加入时自动进行追踪显示
Declaration
Objective-C
@property (nonatomic) BOOL useFaceDetect;
-
设置识别人脸的个数 当设置值小于1时,默认为1;当设置值大于3时,默认为3
最大是3个 最小是1个 如果不需要检测人脸 使用:useFaceDetect = NO
Declaration
Objective-C
@property (nonatomic) int faceDetectCount;
-
是否同步贴合人脸
同步贴合人脸动图会在同步线程执行,优点是贴合性强,缺点是性能差的设备会有卡顿现象 非同步贴合人脸动图,有点是画面流畅但贴图贴合性不强 默认是YES,6及以下机型建议异步,6以上建议同步
Declaration
Objective-C
@property (nonatomic) BOOL faceDectectSync;
-
设备权限
包括麦克风和摄像头权限
Declaration
Objective-C
@property (nonatomic, readonly) AliyunIRecorderDeviceAuthor authorizationStatus;
-
手电筒是否可用
Declaration
Objective-C
@property (nonatomic, readonly) BOOL hasTorch;
-
电筒模式
Declaration
Objective-C
@property (nonatomic, readonly) AliyunIRecorderTorchMode torchMode;
-
获取摄像头位置
Declaration
Objective-C
@property (nonatomic, readonly) AliyunIRecorderCameraPosition cameraPosition;
-
获取最大变焦系数
Declaration
Objective-C
@property (nonatomic, readonly) CGFloat videoMaxZoomFactor;
-
是否正在录制
Declaration
Objective-C
@property (nonatomic, readonly) BOOL isRecording;
-
录音回音效果,默认AliyunIRecorderAECTypeNone,不开启回音消除,API_AVAILABLE(3.19.0)
Declaration
Objective-C
@property (nonatomic) AliyunIRecorderAECType recorderAECType;
-
人脸数量的回调
在useFaceDetect开启的状态下生效
Declaration
Objective-C
@property (nonatomic, copy) void (^)(int) faceNumbersCallback;
-
初始化方法
Declaration
Objective-C
- (instancetype)initWithMediaInfo:(AliyunMixMediaInfoParam *)param outputSize:(CGSize)outputSize;
Parameters
param
媒体信息
outputSize
最终的合成分辨率
Return Value
合拍对象
-
设置合成视频使用的录制音轨 默认使用原始媒体的音轨
Declaration
Objective-C
- (void)setMixAudioSource:(MixAudioSourceType)audioSourceType;
Parameters
audioSourceType
查看MixAudioSourceType定义
-
设置音轨音量,audioSourceType为MixAudioSourceTypeBoth生效 API_AVAILABLE(3.19.0)
Declaration
Objective-C
- (void)setMixAudioOriginalWeight:(int)originalWeight recordWeight:(int)recordWeight;
Parameters
originalWeight
原始音轨混音音量大小[0~100]
recordWeight
录制音轨混音音量大小[0~100]
-
删除最后一段
Declaration
Objective-C
- (void)deleteLastMediaClip;
-
设置可录制的最大时长 默认8
Declaration
Objective-C
- (void)setRecordMaxDuration:(CGFloat)maxDuration;
Parameters
maxDuration
最大时长
-
获取最大录制时长
Declaration
Objective-C
- (CGFloat)recordMaxDuration;
Return Value
具体数值
-
设置可录制的最小时长 默认0.5
Declaration
Objective-C
- (void)setRecordMinDuration:(CGFloat)minDuration;
Parameters
minDuration
最小时长
-
获取最小时长
Declaration
Objective-C
- (CGFloat)recordMinDuration;
Return Value
具体数值
-
获取当前已录制视频时长
Declaration
Objective-C
- (CGFloat)recordDuration;
Return Value
具体时长
-
录制视频的片段数
Declaration
Objective-C
- (NSInteger)partCount;
Return Value
片段数
-
指定合成的背景颜色,默认为0,黑色,API_AVAILABLE(3.19.0)
Declaration
Objective-C
- (void)setBackgroundColor:(int)backgroundColor;
Parameters
backgroundColor
颜色, 如0xfffff;
-
指定合成的背景图片路径 API_AVAILABLE(3.19.0)
Declaration
Objective-C
- (void)setBackgroundImageFilePath:(NSString *)backgroundImageFilePath imageDisplayMode: (AliyunMixVideoBackgroundImageMode)imageDisplayMode;
Parameters
backgroundImageFilePath
图片路径,nil 为不设置图片,默认nil
imageDisplayMode
图片裁剪模式 查看 AliyunMixVideoBackgroundImageMode
-
开始预览
Declaration
Objective-C
- (void)startPreviewWithPositon:(AliyunIRecorderCameraPosition)cameraPosition;
Parameters
cameraPosition
摄像头位置(前置、后置)
-
开始预览 默认前置摄像头
Declaration
Objective-C
- (void)startPreview;
-
停止预览
Declaration
Objective-C
- (void)stopPreview;
-
开始录制
Declaration
Objective-C
- (int)startRecording;
-
停止录制
是否已停止以回调为准
Declaration
Objective-C
- (void)stopRecording;
-
完成录制
是否完成以回调为准
Declaration
Objective-C
- (void)finishRecording;
-
释放录制资源
Declaration
Objective-C
- (void)destroyRecorder;
-
拍摄一张图片 异步获取
image 采集的渲染后图片 rawImage 采集的原始图片
Declaration
Objective-C
- (void)takePhoto:(void (^)(UIImage *, UIImage *))handler;
-
切换摄像头
Declaration
Objective-C
- (AliyunIRecorderCameraPosition)switchCameraPosition;
Return Value
切换后的摄像头位置
-
循环切换手电筒模式 默认为关 (off —> on —> auto)
Declaration
Objective-C
- (AliyunIRecorderTorchMode)switchTorchMode;
Return Value
切换后的手电筒模式
-
切换为指定手电筒模式
Declaration
Objective-C
- (BOOL)switchTorchWithMode:(AliyunIRecorderTorchMode)torchMode;
Parameters
torchMode
指定模式
Return Value
return YES if success
-
添加动图
Declaration
Objective-C
- (int)applyPaster:(AliyunEffectPaster *)paster;
Parameters
paster
动图
-
添加滤镜
Declaration
Objective-C
- (int)applyFilter:(AliyunEffectFilter *)filter;
Parameters
filter
滤镜
-
添加动效滤镜
Declaration
Objective-C
- (int)applyAnimationFilter:(AliyunEffectFilter *)filter;
Parameters
filter
滤镜
Return Value
返回值
-
更新动效滤镜
Declaration
Objective-C
- (int)updateAnimationFilter:(AliyunEffectFilter *)filter;
Parameters
filter
滤镜
Return Value
返回值
-
添加水印
Declaration
Objective-C
- (int)applyImage:(AliyunEffectImage *)image;
Parameters
image
水印
-
添加音乐
Declaration
Objective-C
- (int)applyMusic:(AliyunEffectMusic *)music;
Parameters
music
音乐
Return Value
错误码 只能在录制开始前调用,录制过程或录制完一段或多段后不能调用该接口
-
设置录制速率
Declaration
Objective-C
- (void)setRate:(CGFloat)rate;
Parameters
rate
录制速率 建议0.5-2之间
-
删除效果
Declaration
Objective-C
- (void)deletePaster:(AliyunEffectPaster *)paster;
Parameters
paster
动图
-
删除滤镜
Declaration
Objective-C
- (void)deleteFilter;
-
删除动效滤镜
Declaration
Objective-C
- (void)deleteAnimationFilter;
-
删除水印
Declaration
Objective-C
- (void)deleteImage:(AliyunEffectImage *)image;
Parameters
image
水印
-
设置动图、水印的位置
Declaration
Objective-C
- (void)setEffectView:(CGRect)rect effect:(AliyunEffect *)effect;
Parameters
rect
位置(x,y,width,height)均为比例值 例如播放视频的view的size为(400,400),有动图位置为(50,50,100,100) 则rect参数为(0.125,0.125,0.25,0.25)
effect
指定的效果 (目前支持水印和普通动图)