com.aliyun.svideosdk.editor

## Class EditorCallBack

- java.lang.Object
- - com.aliyun.svideosdk.editor.EditorCallBack

-     public abstract class EditorCallBack
      extends java.lang.Object

  Do not call any SDK method in the callback thread. This can cause the thread to get locked up.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `boolean` | `mNeedPacketCallback` Added in v3.32.0 Sets the packet callbacks to be enabled.
    `int` | `mNeedRenderCallback` Sets the texture callbacks to be enabled.
    `static int` | `RENDER_CALLBACK_CUSTOM` The video texture before effects are added to the video.
    `static int` | `RENDER_CALLBACK_NONE` Use no callback.
    `static int` | `RENDER_CALLBACK_TEXTURE` The video texture after effects are added to the video.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EditorCallBack()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract int` | `onCustomRender(int srcTextureID, int width, int height, long frameTime)` The callback that outputs the texture id before adding effects to the video.
    `abstract void` | `onDataReady()` The callback when the playback data is ready to use.
    `abstract void` | `onEnd(int state)` The callback when the editing is complete.
    `abstract void` | `onError(int rv)` The callback when an error occurs.
    `void` | `onPacketSeek(long offset, int whence)` Added in v3.32.0 The callback that packet seek.
    `abstract void` | `onPlayProgress(long currentPlayTime, long currentStreamPlayTime)` The callback that outputs the progress of playback.
    `void` | `onPlayStateChanged(boolean isPlaying)` Added in v3.33.0 The callback when the play State changed.
    `void` | `onRenderDestroy()`
    `void` | `onRenderSetup()`
    `abstract int` | `onTextureRender(int srcTextureID, int width, int height, long frameTime)` The callback that outputs the texture id after adding effects to the video.
    `void` | `onWritePacket(java.nio.ByteBuffer buffer, int bufferSize)` Added in v3.32.0 The callback that packet.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### RENDER_CALLBACK_NONE

          public static final int RENDER_CALLBACK_NONE

      Use no callback.
      See Also:
        Constant Field Values

    - #### RENDER_CALLBACK_CUSTOM

          public static final int RENDER_CALLBACK_CUSTOM

      The video texture before effects are added to the video.
      See Also:
        Constant Field Values

    - #### RENDER_CALLBACK_TEXTURE

          public static final int RENDER_CALLBACK_TEXTURE

      The video texture after effects are added to the video.
      See Also:
        Constant Field Values

    - #### mNeedRenderCallback

          public int mNeedRenderCallback

      Sets the texture callbacks to be enabled. Use vertical bars (|) to enable multiple callbacks. For example, RENDER_CALLBACK_CUSTOM | RENDER_CALLBACK_TEXTURE indicates both callbacks are enabled.

    - #### mNeedPacketCallback

          public boolean mNeedPacketCallback

      Added in v3.32.0 Sets the packet callbacks to be enabled.

  - ### Constructor Detail

    - #### EditorCallBack

          public EditorCallBack()

  - ### Method Detail

    - #### onEnd

          public abstract void onEnd(int state)

      The callback when the editing is complete.
      Parameters:
        `state` - 0 indicates playback the video. 1 indicates export the video.

    - #### onError

          public abstract void onError(int rv)

      The callback when an error occurs.
      Parameters:
        `rv` - The error code. VideoPool: `AliyunErrorCode.ALIVC_FRAMEWORK_MEDIA_POOL_WRONG_STATE` indicates that the state is incorrect. `AliyunErrorCode.ALIVC_FRAMEWORK_DEMUXER_INIT_MULTI_TIMES` indicates that DEMUXER is initialized multiple times. `AliyunErrorCode.ALIVC_FRAMEWORK_DEMUXER_OPEN_FILE_FAILED` indicates that an error occurred while starting DEMUXER. `AliyunErrorCode.ALIVC_FRAMEWORK_DEMUXER_FIND_STREAM_INFO_FAILED` indicates that DEMUXER failed to obtain stream information. `AliyunErrorCode.ALIVC_FRAMEWORK_VIDEO_DECODER_CREATE_DECODER_FAILED` indicates that an error occurred while creating the decoder. `AliyunErrorCode.ALIVC_FRAMEWORK_VIDEO_DECODER_ERROR_STATE` indicates that the decoder state is incorrect. `AliyunErrorCode.ALIVC_FRAMEWORK_VIDEO_DECODER_ERROR_INPUT` indicates that the decoder input is incorrect. `AliyunErrorCode.ALIVC_FRAMEWORK_VIDEO_DECODER_SPS_PPS_NULL` indicates that the SPSPPS parameter of the decoder is null. `AliyunErrorCode.ALIVC_FRAMEWORK_VIDEO_DECODER_CREATE_H264_PARAM_SET_FAILED` indicates that an error occurred while creating H264 decoding parameters. `AliyunErrorCode.ALIVC_FRAMEWORK_VIDEO_DECODER_CREATE_HEVC_PARAM_SET_FAILED` indicates that an error occurred while creating HEVC decoding parameters. `AliyunErrorCode.ALIVC_FRAMEWORK_MEDIA_POOL_CACHE_DATA_SIZE_OVERFLOW` indicates that the cache memory is full. AudioPool: `AliyunErrorCode.ALIVC_FRAMEWORK_MEDIA_POOL_WRONG_STATE` indicates that the state is incorrect. `AliyunErrorCode.ALIVC_FRAMEWORK_DEMUXER_INIT_MULTI_TIMES` indicates that DEMUXER is initialized multiple times. `AliyunErrorCode.ALIVC_FRAMEWORK_DEMUXER_OPEN_FILE_FAILED` indicates that an error occurred while starting DEMUXER. `AliyunErrorCode.ALIVC_FRAMEWORK_DEMUXER_FIND_STREAM_INFO_FAILED` indicates that DEMUXER failed to obtain stream information. `AliyunErrorCode.ALIVC_FRAMEWORK_AUDIO_DECODER_CREATE_DECODER_FAILED` indicates that an error occurred while creating the decoder. `AliyunErrorCode.ALIVC_FRAMEWORK_AUDIO_DECODER_ERROR_STATE` indicates that the decoder state is incorrect. `AliyunErrorCode.ALIVC_FRAMEWORK_AUDIO_DECODER_ERROR_INPUT` indicates that the decoder input is incorrect.

    - #### onRenderSetup

          public void onRenderSetup()

    - #### onRenderDestroy

          public void onRenderDestroy()

    - #### onCustomRender

          public abstract int onCustomRender(int srcTextureID,
                                             int width,
                                             int height,
                                             long frameTime)

      The callback that outputs the texture id before adding effects to the video.
      Parameters:
        `srcTextureID` - The old texture id.
        `width` - The width of the texture.
        `height` - The height of the texture.
        `frameTime` - frame render time relative to editor timeline in microsecond unit
      Returns:
        The texture id after the rendering.

    - #### onTextureRender

          public abstract int onTextureRender(int srcTextureID,
                                              int width,
                                              int height,
                                              long frameTime)

      The callback that outputs the texture id after adding effects to the video.
      Parameters:
        `srcTextureID` - The old texture id.
        `width` - The width of the texture.
        `height` - The height of the texture.
        `frameTime` - frame render time relative to editor timeline in microsecond unit
      Returns:
        The texture id after the rendering.

    - #### onPlayProgress

          public abstract void onPlayProgress(long currentPlayTime,
                                              long currentStreamPlayTime)

      The callback that outputs the progress of playback. For example, if the playback of a 10-second video is slowed down to 15 seconds, currentPlayTime=15s and currentStreamPlayTime=10s when the playback reaches the last second.
      Parameters:
        `currentPlayTime` - The current time on the playback timeline.
        `currentStreamPlayTime` - The current time on the stream timeline.

    - #### onDataReady

          public abstract void onDataReady()

      The callback when the playback data is ready to use.

    - #### onPlayStateChanged

          public void onPlayStateChanged(boolean isPlaying)

      Added in v3.33.0 The callback when the play State changed.
      Parameters:
        `isPlaying` - is playing

    - #### onWritePacket

          public void onWritePacket(java.nio.ByteBuffer buffer,
                                    int bufferSize)

      Added in v3.32.0 The callback that packet.
      Parameters:
        `buffer` - data
        `bufferSize` - data size

    - #### onPacketSeek

          public void onPacketSeek(long offset,
                                   int whence)

      Added in v3.32.0 The callback that packet seek.
      Parameters:
        `offset` - offset
        `whence` - whence