IZegoCustomVideoProcessHandler
IZegoCustomVideoProcessHandler
Declared in callback/IZegoCustomVideoProcessHandler.java
Methods
onStart
public void onStart(ZegoPublishChannel channel)callback/IZegoCustomVideoProcessHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publishing stream channel. |
Details
When the custom video pre-processing is turned on, the SDK informs the developer that the video pre-processing is about to start, and it is recommended to initialize other resources(E.g. Beauty SDK) in this callback.
- Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video. When to
- Trigger: Open custom video pre-processing, after calling [startPreview] or [startPublishingStream] successfully.
- Related callbacks: Custom video pre-processing end notification [onStop].
- Related APIs: Call [setCustomVideoProcessHandler] function to set custom video pre-processing callback.
- Available since: 2.2.0
onStop
public void onStop(ZegoPublishChannel channel)callback/IZegoCustomVideoProcessHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| channel | ZegoPublishChannel | Publishing stream channel. |
Details
When the custom video pre-processing is turned on, the SDK informs the developer that the video pre-processing is about to end, and it is recommended to destroy other resources(E.g. Beauty SDK) in this callback.
- Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video. When to
- Trigger: If you call [startPreview] to start the preview and [startPublishingStream] to start the push stream at the same time after you start the custom capture, you should call [stopPreview] to stop the preview and [stopPublishingStream] to stop the push stream before the callback will be triggered.
- Related callbacks: Custom video pre-processing start notification [onStart].
- Related APIs: Call [setCustomVideoProcessHandler] function to set custom video pre-processing callback.
- Available since: 2.2.0
onCapturedUnprocessedRawData
public void onCapturedUnprocessedRawData(ByteBuffer data, int[] dataLength, ZegoVideoFrameParam param, long referenceTimeMillisecond, ZegoPublishChannel channel)callback/IZegoCustomVideoProcessHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| data | ByteBuffer | Raw video data. RGB format data storage location is data[0], YUV format data storage location is Y component:data[0], U component:data[1], V component:data[2]. |
| dataLength | int[] | Raw video data length. RGB format data length storage location is dataLength[0], YUV format data storage location respectively Y component length:dataLength[0], U component length:dataLength[1], V component length:dataLength[2]. |
| param | ZegoVideoFrameParam | Video frame parameters. |
| referenceTimeMillisecond | long | video frame reference time, UNIX timestamp, or system startup timestamp, in milliseconds. |
| channel | ZegoPublishChannel | Publishing stream channel. |
Details
When the custom video pre-processing is turned on, after calling [setCustomVideoProcessHandler] to set the callback, the SDK receives the original video data and calls back to the developer. After the developer has processed the original image, he must call [sendCustomVideoProcessedRawData] to send the processed data back to the SDK, otherwise it will cause frame loss.
- Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video. When to
- Trigger: When the custom video pre-processing is enabled, the SDK collects the original video data.
- Platform differences: Available for Window, Android platforms.
- Available since: 2.2.0
- Restrictions: This interface takes effect when [enableCustomVideoProcessing] is called to enable custom video pre-processing and the bufferType of config is passed in [ZegoVideoBufferTypeRawData].
onCapturedUnprocessedTextureData
public void onCapturedUnprocessedTextureData(int textureID, int width, int height, long referenceTimeMillisecond, ZegoPublishChannel channel)callback/IZegoCustomVideoProcessHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| textureID | int | Texture ID. |
| width | int | Texture width. |
| height | int | Texture height. |
| referenceTimeMillisecond | long | video frame reference time, UNIX timestamp, in milliseconds. |
| channel | ZegoPublishChannel | Publishing stream channel. |
Details
When the custom video pre-processing is turned on, after calling [setCustomVideoProcessHandler] to set the callback, the SDK receives the original video data and calls back to the developer. After the developer has processed the original image, he must call [sendCustomVideoProcessedTextureData] to send the processed data back to the SDK, otherwise it will cause frame loss.
- Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video. When to
- Trigger: When the custom video pre-processing is enabled, the SDK collects the original video data.
- Platform differences: It only takes effect on the Android platform.
- Available since: 2.2.0
- Restrictions: This interface takes effect when [enableCustomVideoProcessing] is called to enable custom video pre-processing and the bufferType of config is passed in [ZegoVideoBufferTypeGLTexture2D].
getCustomVideoProcessInputSurfaceTexture
public SurfaceTexture getCustomVideoProcessInputSurfaceTexture(int width, int height, ZegoPublishChannel channel)callback/IZegoCustomVideoProcessHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| width | int | The capture width of the original video. |
| height | int | The capture height of the original video. |
| channel | ZegoPublishChannel | Publishing stream channel. |
Details
To enable custom video pre-processing, developers need to create a SurfaceTexture object and listen to its member method [setOnFrameAvailableListener], and then return the corresponding SurfaceTexture. When the SDK raw video data input is completed, the developer will receive [onFrameAvailable]. After the developer passes the SurfaceTexture(input) object to the SDK, he can call [getCustomVideoProcessOutputSurfaceTexture] to get the SurfaceTexture used by the SDK to encode and push the stream, and then the developer can pass the video processed data into this SurfaceTexture(output) object.
- Use cases: After the developer collects the video data by himself or obtains the video data collected by the SDK, if the basic beauty and watermark functions of the SDK cannot meet the needs of the developer (for example, the beauty effect cannot meet the expectations), the ZegoEffects SDK can be used to perform the video Some special processing, such as beautifying, adding pendants, etc., this process is the pre-processing of custom video.
- Platform differences: It only takes effect on the Android platform.
- Available since: 2.2.0
- Restrictions: This interface takes effect when [enableCustomVideoProcessing] is called to enable custom video pre-processing and the bufferType of config is passed in [ZegoVideoBufferTypeSurfaceTexture].
Return
SurfaceTexture instance.
