com.aliyun.svideosdk.multirecorder

## Interface AliyunIVideoRecorder

-     public interface AliyunIVideoRecorder

  An interface for video recording. Added in v3.22.0

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `addWaterMark(EffectImage effectImage)` Adds a watermark image.
    `void` | `cancelRecording()` Cancels recording.
    `int` | `clearBackground()` clear background
    `void` | `destroy()` Releases resources.
    `int` | `finishRecording()` Stops recording and starts the composition process.
    `Uri` | `finishRecordingForEdit()` Added in v3.23.0, stops recording and saves information about recorded clips into a JSON file.
    `AliyunIClipManager` | `getClipManager()` Gets the clip manager.
    `AliyunIVideoCapture` | `getVideoCapture()`
    `void` | `prepare()` prepare capture sources Note: call after adding all capture sources, otherwise can not call `startPreview()` and `startRecording()`
    `void` | `removeMusic()` Remove the background music
    `int` | `removeWaterMark(EffectImage effectImage)` Removes a watermark image.
    `int` | `setBackgroundColor(int color)` Set the background color
    `int` | `setBackgroundDisplayMode(int displayMode)` Set the background image display mode
    `int` | `setBackgroundImage(Bitmap bitmap)` Set the background image with bitmap
    `void` | `setEncoderInfoCallback(EncoderInfoCallback callback)` Sets the callback that outputs encoder parameters.
    `void` | `setIsAutoClearClipVideos(boolean isAutoClear)` Added in v3.23.0, set whether to clear the clip video files, default is false Note: if you set true, you should not use `AliyunIRecorder.finishRecordingForEdit()`
    `int` | `setMicDenoiseWeight(int denoiseWeight)` Added in v3.27.0 Denoises the mic audio stream.
    `void` | `setMixAudioWeight(int bgmWeight, int micWeight)` Added in v3.27.0 set the audio volume when mix
    `int` | `setMusic(java.lang.String path, long startTime, long duration)` Sets the background music during recording.
    `void` | `setMute(boolean isMute)` Sets whether to mute the recording.
    `void` | `setOnAudioCallback(OnAudioCallBack callback)` Sets the callback that outputs audio data in 44.1 kHz 16-bit mono PCM format.
    `void` | `setOnRecordListener(OnVideoRecordListener listener)` Sets the recording listener.
    `void` | `setOpenMicAEC(boolean open)` Added in v3.27.0 Set whether to open mic aec effect
    `void` | `setOpenMixAudioMode(boolean open)` Added in v3.27.0 Set whether to mix audios, default is false
    `void` | `setRate(float rate)` Sets the recording speed.
    `int` | `startPreview()` Starts preview.
    `int` | `startRecording()` Starts recording.
    `void` | `stopPreview()` Stops preview.
    `int` | `stopRecording()` Stops recording.
    `int` | `updateVideoSize(int width, int height)` Sets the output video size.
    `java.lang.String` | `version()` Gets the SDK version.

- - ### Method Detail

    - #### getVideoCapture

          AliyunIVideoCapture getVideoCapture()

    - #### getClipManager

          AliyunIClipManager getClipManager()

      Gets the clip manager.
      Returns:
        The clip manager.
      See Also:
        `AliyunIClipManager`

    - #### updateVideoSize

          int updateVideoSize(int width,
                              int height)

      Sets the output video size.
      Parameters:
        `width` -
        `height` -

    - #### prepare

          void prepare()

      prepare capture sources Note: call after adding all capture sources, otherwise can not call `startPreview()` and `startRecording()`
      See Also:
        `AliyunIVideoCapture`

    - #### startPreview

          int startPreview()

      Starts preview. It is recommended to call this method in `Activity#onResume()`.

    - #### stopPreview

          void stopPreview()

      Stops preview. It is recommended to call this method in `Activity#onPause()`.

    - #### destroy

          void destroy()

      Releases resources.

    - #### setMusic

          int setMusic(java.lang.String path,
                       long startTime,
                       long duration)

      Sets the background music during recording.
      Parameters:
        `path` - The path of the music file.
        `startTime` - The music start time. Unit: milliseconds.
        `duration` - The duration of the music. Unit: milliseconds.
      Returns:
        0 if the invocation is successful or an error code `AliyunErrorCode` if the invocation fails.

    - #### removeMusic

          void removeMusic()

      Remove the background music

    - #### setRate

          void setRate(float rate)

      Sets the recording speed.
      Parameters:
        `rate` - Valid values: [0.5, 2.0]

    - #### setMute

          void setMute(boolean isMute)

      Sets whether to mute the recording. NOTICE: It controls whether the microphone is mute.
      Parameters:
        `isMute` - Whether to mute the recording.

    - #### startRecording

          int startRecording()

      Starts recording.

    - #### stopRecording

          int stopRecording()

      Stops recording.

    - #### finishRecording

          int finishRecording()

      Stops recording and starts the composition process.

    - #### finishRecordingForEdit

          Uri finishRecordingForEdit()

      Added in v3.23.0, stops recording and saves information about recorded clips into a JSON file.
      Returns:
        The URI of the JSON file.

    - #### cancelRecording

          void cancelRecording()

      Cancels recording.

    - #### setOnRecordListener

          void setOnRecordListener(OnVideoRecordListener listener)

      Sets the recording listener.
      Parameters:
        `listener` -
      See Also:
        `OnVideoRecordListener`

    - #### setEncoderInfoCallback

          void setEncoderInfoCallback(EncoderInfoCallback callback)

      Sets the callback that outputs encoder parameters.
      Parameters:
        `callback` -
      See Also:
        `EncoderInfoCallback`

    - #### setOnAudioCallback

          void setOnAudioCallback(OnAudioCallBack callback)

      Sets the callback that outputs audio data in 44.1 kHz 16-bit mono PCM format.
      Parameters:
        `callback` -

    - #### version

          java.lang.String version()

      Gets the SDK version.
      Returns:
        The SDK version represented as a string.

    - #### addWaterMark

          int addWaterMark(EffectImage effectImage)

      Adds a watermark image. To add a text watermark, use bitmap tools to convert texts into images.
      Parameters:
        `effectImage` -
      Returns:
        0 if the invocation is successful or an error code if the invocation fails.

    - #### removeWaterMark

          int removeWaterMark(EffectImage effectImage)

      Removes a watermark image.
      Parameters:
        `effectImage` - The same with the param for `addWaterMark(EffectImage)`

    - #### setBackgroundColor

          int setBackgroundColor(int color)

      Set the background color
      Parameters:
        `color` -
      Returns:
        `AliyunErrorCode.OK` if the invocation is successful or an error code if the invocation fails.

    - #### setBackgroundDisplayMode

          int setBackgroundDisplayMode(int displayMode)

      Set the background image display mode
      Parameters:
        `displayMode` - 0：crop 1：fill 2：exact fit
      Returns:
        `AliyunErrorCode.OK` if the invocation is successful or an error code if the invocation fails.

    - #### setBackgroundImage

          int setBackgroundImage(Bitmap bitmap)

      Set the background image with bitmap
      Parameters:
        `bitmap` -
      Returns:
        `AliyunErrorCode.OK` if the invocation is successful or an error code if the invocation fails.

    - #### clearBackground

          int clearBackground()

      clear background
      Returns:

    - #### setIsAutoClearClipVideos

          void setIsAutoClearClipVideos(boolean isAutoClear)

      Added in v3.23.0, set whether to clear the clip video files, default is false Note: if you set true, you should not use `AliyunIRecorder.finishRecordingForEdit()`
      Parameters:
        `isAutoClear` -

    - #### setMicDenoiseWeight

          int setMicDenoiseWeight(int denoiseWeight)

      Added in v3.27.0 Denoises the mic audio stream.
      Parameters:
        `denoiseWeight` - 0:close 100:max

    - #### setOpenMicAEC

          void setOpenMicAEC(boolean open)

      Added in v3.27.0 Set whether to open mic aec effect
      Parameters:
        `open` - true:open false:close

    - #### setOpenMixAudioMode

          void setOpenMixAudioMode(boolean open)

      Added in v3.27.0 Set whether to mix audios, default is false
      Parameters:
        `open` - true:open false:close

    - #### setMixAudioWeight

          void setMixAudioWeight(int bgmWeight,
                                 int micWeight)

      Added in v3.27.0 set the audio volume when mix
      Parameters:
        `bgmWeight` - [0~100]
        `micWeight` - [0~100]