AliyunIRecorder

@interface AliyunIRecorder : NSObject

* A class that defines recorders.

  • * The preview view.

    Required.

    Declaration

    Objective-C

    @property(nonatomic, strong) UIView *preview
  • * The video output path.

    Required.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *outputPath;
  • * The path of the taskPath folder.

    Required. Enter a valid path.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *taskPath;
  • * The delegate.

    Declaration

    Objective-C

    @property (nonatomic, weak) id<AliyunIRecorderDelegate> delegate;
  • * Whether beauty mode is enabled or not.

    Declaration

    Objective-C

    @property (nonatomic) BOOL beautifyStatus;
  • * The beauty level. Valid values: [0, 100]

    Declaration

    Objective-C

    @property (nonatomic) int beautifyValue;
  • * The exposure level. Valid values: [0, 1]

    Declaration

    Objective-C

    @property (nonatomic) CGFloat exposureValue;
  • * The capture resolution of the front camera.

    Default value: AVCaptureSessionPreset640x480 For more parameters, see: AVCaptureSession.h

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *frontCaptureSessionPreset;
  • * The capture resolution of the rear camera.

    Default value: AVCaptureSessionPreset1280x720 For more parameters, see: AVCaptureSession.h

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *backCaptureSessionPreset;
  • * The rotation angle of the camera.

    Declaration

    Objective-C

    @property (nonatomic) int cameraRotate;
  • * The focus point on the preview.

    Declaration

    Objective-C

    @property (nonatomic) CGPoint focusPoint;
  • * The zoom factor.

    The actual value is one hundredth of the specified value. For example, when videoZoomFactor is set to 10.0f, the actual zoom is += 0.1f. When videoZoomFactor is set to -5.0f, the actual zoom is -= 0.05f This parameter does not apply to the front camera.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat videoZoomFactor;
  • * The front camera is not support zoom factor in default. when frontCameraSupportVideoZoomFactor is set YES,the front camera support zoom factor .

    Declaration

    Objective-C

    @property (nonatomic) BOOL frontCameraSupportVideoZoomFactor;
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, assign) BOOL videoFlipH
  • * The encoding mode.

    0 indicates software encoding. 1 indicates hardware encoding. Hardware encoding is required in iOS.

    Declaration

    Objective-C

    @property (nonatomic) int encodeMode;
  • GOP

    * The GOP size. Valid values: [0, 9,000]. Both 0 and 1 indicate full I-frames.

    Default value: 5

    Declaration

    Objective-C

    @property (nonatomic) int GOP;
  • * The recording frame rate. Valid values: (0, 30] The default value is used if an invalid value is specified.

    Default value: 25

    Declaration

    Objective-C

    @property (nonatomic) int recordFps;
  • * Whether the recording is muted or not.

    This parameter is invalid if music is added.

    Declaration

    Objective-C

    @property (nonatomic) BOOL mute;
  • * The video quality. This parameter is invalid if the bitrate parameter is set.

    Declaration

    Objective-C

    @property (nonatomic) AliyunVideoQuality videoQuality;
  • * The video output bitrate in bit/s. Valid values: [200,000, 20,000,000]

    Declaration

    Objective-C

    @property (nonatomic) int bitrate;
  • * The pixel format. Select one from the following three formats: kCVPixelFormatType_420YpCbCr8BiPlanarFullRange kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange kCVPixelFormatType_32BGRA Default is kCVPixelFormatType_420YpCbCr8BiPlanarFullRange.

    Declaration

    Objective-C

    @property (nonatomic) AliyunIRecorderVideoOutputPixelFormatType outputType;
  • * Whether facial recognition is enabled.

    When facial recognition is enabled, the movements of human faces are automatically detected and tracked.

    Declaration

    Objective-C

    @property (nonatomic) BOOL useFaceDetect;
  • * Sets the maximum number of faces that can be recognized at the same time. Valid values: 1, 2, and 3.

    To disable facial recognition, set useFaceDetect to NO.

    Declaration

    Objective-C

    @property (nonatomic) int faceDetectCount;
  • * Whether to synchronize with the movements of human faces.

    When enabled, the movements of human faces are dynamically synchronized to the video. For models that have poor capabilities, video stuttering may occur. When disabled, the movements of human faces are not dynamically synchronized to the video. This ensures smooth video recording. Default is YES. It is recommended to select Yes for iPhone models above 6.

    Declaration

    Objective-C

    @property (nonatomic) BOOL faceDectectSync;
  • * The device permissions.

    Microphone and camera permissions.

    Declaration

    Objective-C

    @property (nonatomic, readonly) AliyunIRecorderDeviceAuthor authorizationStatus;
  • * Whether the torch is available.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL hasTorch;
  • * The torch mode.

    Declaration

    Objective-C

    @property (nonatomic, readonly) AliyunIRecorderTorchMode torchMode;
  • * The camera type.

    Declaration

    Objective-C

    @property (nonatomic, readonly) AliyunIRecorderCameraPosition cameraPosition;
  • * The maximum zoom factor.

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat videoMaxZoomFactor;
  • * Whether the recording is in progress.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isRecording;
  • * The clip manager.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) AliyunClipManager *clipManager;
  • Deprecated

    3.19.0废弃

    * AVAudioSession use AVAudioSessionModeVideoRecording to record,default is yes

    Declaration

    Objective-C

    @property (nonatomic) BOOL useAudioSessionModeVideoRecording;
  • * Gets the SDK version.

    Declaration

    Objective-C

    + (NSString *)version;

    Return Value

    The SDK version.

  • * Initializer.

    Declaration

    Objective-C

    - (instancetype)initWithDelegate:(id<AliyunIRecorderDelegate>)delegate
                           videoSize:(CGSize)videoSize;

    Parameters

    delegate

    The delegate.

    videoSize

    The video resolution. Even numbers only. Must not be set to the screen resolution. Recommended values: 320*480, 540*960, and 720*1280.

    Return Value

    An AliyunIRecorder object.

  • * Starts preview.

    Declaration

    Objective-C

    - (void)startPreviewWithPositon:(AliyunIRecorderCameraPosition)cameraPosition;

    Parameters

    cameraPosition

    The camera type. Front camera or rear camera.

  • * Starts preview. The front camera is used by default.

    Declaration

    Objective-C

    - (void)startPreview;
  • * Stops preview.

    Declaration

    Objective-C

    - (void)stopPreview;
  • * Changes the video resolution.

    Declaration

    Objective-C

    - (void)reStartPreviewWithVideoSize:(CGSize)videoSize;

    Parameters

    videoSize

    The new resolution.

  • * Starts recording.

    Declaration

    Objective-C

    - (int)startRecording;
  • * Stops recording.

    The callback indicates whether the recording is successfully stopped.

    Declaration

    Objective-C

    - (void)stopRecording;
  • * Finishes recording.

    The callback indicates whether the recording is successfully finished.

    Declaration

    Objective-C

    - (void)finishRecording;
  • Undocumented

    Declaration

    Objective-C

    - (NSString *) finishRecordingForEdit;
  • * Releases resources.

    Declaration

    Objective-C

    - (void)destroyRecorder;
  • * Takes a picture asynchronously.

    image The image after rendering. rawImage The original image.

    Declaration

    Objective-C

    - (void)takePhoto:(void (^)(int *, int *))handler;
  • * Switches the camera.

    Declaration

    Objective-C

    - (AliyunIRecorderCameraPosition)switchCameraPosition;

    Return Value

    The type of the camera that is in use.

  • * Switches the torch mode. Default is off. The preset sequence of torch modes is: off —> on —> auto

    Declaration

    Objective-C

    - (AliyunIRecorderTorchMode)switchTorchMode;

    Return Value

    The torch mode to be used.

  • * Switches to a specified torch mode.

    Declaration

    Objective-C

    - (BOOL)switchTorchWithMode:(AliyunIRecorderTorchMode)torchMode;

    Parameters

    torchMode

    The torch mode to be used.

    Return Value

    YES if the invocation is successful.

  • * The callback that outputs the number of human faces.

    This parameter only takes effect when useFaceDetect is set to YES.

    Declaration

    Objective-C

    @property (nonatomic, copy) void (^)(int) faceNumbersCallback;
  • * Tracks human faces. External face recognition libraries are allowed if face data is represented using AliyunFacePoint.

    Declaration

    Objective-C

    - (void)faceTrack:(NSArray<AliyunFacePoint *> *)facePoints;

    Parameters

    facePoints

    The face coordinate in an array.

  • * Applies a sticker.

    Declaration

    Objective-C

    - (int)applyPaster:(AliyunEffectPaster *)paster;

    Parameters

    paster

    The sticker to be applied.

  • * Applies a filter.

    Declaration

    Objective-C

    - (int)applyFilter:(AliyunEffectFilter *)filter;

    Parameters

    filter

    The filter to be applied.

  • * Applies an animated filter.

    Declaration

    Objective-C

    - (int)applyAnimationFilter:(AliyunEffectFilter *)filter;

    Parameters

    filter

    The filter to be applied.

    Return Value

    A return value.

  • * update an animated filter.

    Declaration

    Objective-C

    - (int)updateAnimationFilter:(AliyunEffectFilter *)filter;

    Parameters

    filter

    The filter to be applied.

    Return Value

    A return value.

  • Deprecated

    This method will not be supported any more. Do not use it.

    * Applies an MV effect.

    Declaration

    Objective-C

    - (int)applyMV:(AliyunEffectMV *)mv;

    Parameters

    mv

    The MV effect to be applied.

    Return Value

    A return value. This method can only be called before recording is started. Deprecated.

  • * Applies a watermark.

    Declaration

    Objective-C

    - (int)applyImage:(AliyunEffectImage *)image;

    Parameters

    image

    The watermark image to be applied.

  • * Applies a music effect.

    Declaration

    Objective-C

    - (int)applyMusic:(AliyunEffectMusic *)music;

    Parameters

    music

    The music effect to be applied.

    Return Value

    A return value. This method can only be called before recording is started.

  • * Sets the recording speed.

    Declaration

    Objective-C

    - (void)setRate:(CGFloat)rate;

    Parameters

    rate

    The recording speed. Recommended values: [0.5, 2.0]

  • * Removes a sticker.

    Declaration

    Objective-C

    - (void)deletePaster:(AliyunEffectPaster *)paster;

    Parameters

    paster

    The sticker to be removed.

  • * Removes a filter.

    Declaration

    Objective-C

    - (void)deleteFilter;
  • * Removes an animated filter.

    Declaration

    Objective-C

    - (void)deleteAnimationFilter;
  • * Removes a watermark.

    Declaration

    Objective-C

    - (void)deleteImage:(AliyunEffectImage *)image;

    Parameters

    image

    The watermark image to be deleted.

  • * Sets the coordinate of a sticker or watermark.

    Declaration

    Objective-C

    - (void)setEffectView:(CGRect)rect effect:(AliyunEffect *)effect;

    Parameters

    rect

    The coordinate, (x,y,width,height), is relative to the view size. If the view size is (400, 400), and the position of the sticker is (50, 50, 100, 100), the value of rect is set to (0.125,0.125,0.25,0.25).

    effect

    Currently, only stickers and watermarks are supported.